0

I tested the .NET SDK code from the /MIchaelMainer/working branch, and it worked fine for work accounts.

However, it fails ("Authentication failed") for personal accounts (even small files).

The documentation about resumable uploads doesn't say anything about this being a work accounts feature only.

Perhaps it is? Or is there a bug? If it is a bug, I don't see in the code where it could be, because the single difference is the account type.

(related: https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/61)

Michael Mainer
  • 3,387
  • 1
  • 13
  • 32
horacioj
  • 687
  • 1
  • 8
  • 25
  • Are you including the Authorization header when writing the fragments of the file? This can result in the error you're seeing as it isn't necessary to include the Authorization header when writing to an upload session. – Ryan Gregg Nov 07 '16 at 23:43

1 Answers1

0

Thanks, Ryan.

In UploadChunkRequest.cs => SendRequestAsync(), I did this update (line commented):

        using (var request = this.GetHttpRequestMessage())
        {
            //await this.Client.AuthenticationProvider.AuthenticateRequestAsync(request).ConfigureAwait(false);

            request.Content = new StreamContent(stream);
            request.Content.Headers.ContentRange =
                new ContentRangeHeaderValue(this.RangeBegin, this.RangeEnd, this.TotalSessionLength);
            request.Content.Headers.ContentLength = this.RangeLength;

            return await this.Client.HttpProvider.SendAsync(request, completionOption, cancellationToken).ConfigureAwait(false);
        }

Now the chunked upload works fine for personal and business accounts!

Michael will update the code in GitHub, I think?

What I'm still unable to do is upload to a shared folder.

Community
  • 1
  • 1
horacioj
  • 687
  • 1
  • 8
  • 25