Fix "ItemNotFound" when uploading file
I initially filed this bug here and was told to file it here as well: https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/385
I am able to upload a file to OneDrive (into the apps app folder).
An excpetion is thrown (see below) - but only sometimes!
I feel like it mostly (or only) happens the first time the app tries to upload something to its (newly created) app folder. It usually (if not always) succeeds on a second attempt.
Microsoft.Graph.ServiceException: Code: itemNotFoundMessage: Item does not exist
Steps to reproduce the behavior
static async Task UploadFile(GraphServiceClient graphClient, string filePath, MemoryStream stream)
if (stream.Length > 4194304)
var session = await graphClient.Drive.Special.AppRoot.ItemWithPath(filePath).CreateUploadSession().Request().PostAsync();
await new ChunkedUploadProvider(session, graphClient, stream).UploadAsync();
I can also provide a ton of request-id's + timestamps for this error:
request-id: 19c3d1c1-c426-4bf5-a26e-3e5f0b883e55, date: 21.06.2019 07:15:05
request-id: 1c0d5295-431b-4597-89d2-094893c227d9, date: 21.06.2019 09:15:02
request-id: 425a9d48-2e25-4f87-bfba-6c9340668b39, date: 21.06.2019 06:27:45
request-id: 50f95c9f-e8bb-4373-869c-4fe420a76985, date: 21.06.2019 06:29:05
request-id: 5682a0ba-e7fe-4eef-a7e2-b73795df3bee, date: 21.06.2019 06:59:05