Some accounts cannot upload files

runxing qiu 40 Reputation points
2024-06-04T09:37:05.1933333+00:00

We've been using this feature for a long time and in recent days we've noticed that some accounts can't upload files, but some do. The only apparent difference is the URL used for uploading. The abnormal accounts use https://my.microsoftpersonalcontent.com/personal, while the available accounts use https://api.onedrive.com/rup/ and uploaded URLs are from UploadSession. What could be causing this difference?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,258 questions
{count} votes

1 answer

Sort by: Most helpful
  1. dnowak5f 10 Reputation points
    2024-07-31T13:37:36.7566667+00:00

    We faced the same issue, which turned out to be caused by including an authorization header in the upload task.

    As per docs:

    If you include the Authorization header when issuing the PUT call, it may result in an HTTP 401 Unauthorized response. Only send the Authorization header and bearer token when issuing the POST during the first step. Don't include it when you issue the PUT call.

    So, the solution can be to create a separate GraphServiceClient with an AuthenticationProvider that does nothing and to pass its RequestAdapter when creating a LargeFileUploadTask.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.