Personal OneDrive createUploadSession returns HTTP 400 with delegated Files.ReadWrite.AppFolder

Matts Global 0 Reputation points
2026-11-27T22:34:16.0866667+00:00

I am validating a public-client integration using an isolated, disposable Personal OneDrive account. The only delegated file-access permission is Files.ReadWrite.AppFolder. The issue blocks fictional development validation only. Production is unaffected.

Before dispatch, I independently verified the approved test account, the app root and the exact isolated child folder. Read-only checks for the new fictional file CH-1102.docx returned HTTP 404 through both the verified drive and Personal OneDrive routes.

Request

POST /v1.0/me/drive/items/{verified-test-folder-id}:/CH-1102.docx:/createUploadSession
Host: graph.microsoft.com
Content-Type: application/json
client-request-id: ece4b7ae-2584-45a3-9b87-47be9b7ed835
return-client-request-id: true

{
  "item": {
    "name": "CH-1102.docx",
    "fileSize": 39154,
    "@microsoft.graph.conflictBehavior": "fail"
  },
  "deferCommit": true
}

The session-creation request had no conditional headers. Exactly one POST was sent with zero retries, zero DOCX bytes and no session returned.

Response

{
  "error": {
    "code": "invalidRequest",
    "message": "Invalid request",
    "innerError": {
      "date": "2026-11-27T10:29:26.000Z",
      "request-id": "5554fb2d-2032-4c97-a74c-a549c9f0e071",
      "client-request-id": "ece4b7ae-2584-45a3-9b87-47be9b7ed835"
    }
  }
}

HTTP status 400. Graph response request ID 5554fb2d-2032-4c97-a74c-a549c9f0e071. Client request ID ece4b7ae-2584-45a3-9b87-47be9b7ed835 was echoed. The provider HTTP Date was Fri, 27 Nov 2026 21:29:25 GMT. Client timestamps were 2026-11-27T21:29:25.147Z to 2026-11-27T21:29:26.502Z (28 November 2026, 08:29:25.147–08:29:26.502 AEDT). The nested error contains correlation metadata and no more specific error code. The nested date was normalised by the recorder and differs from the HTTP Date, so please use the HTTP Date and client UTC timestamps for correlation.

Original occurrence, kept separate: Graph request ID 1bed9988-bb54-4e95-a223-649665016b75, HTTP 400 invalidRequest, approximate client log time 2026-11-27T20:53:42.709Z.

Please trace the rejection and confirm the supported request contract for Personal OneDrive under delegated Files.ReadWrite.AppFolder. If this endpoint is supported under that scope, what session-creation and explicit Personal OneDrive deferred-completion sequence preserves create-only behaviour when the target name is created concurrently? The planned final PUT keeps conflict behaviour fail and If-None-Match: *. The cause of the rejection has not been established.

Microsoft Graph upload-session API and AppFolder documentation.

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Newest
  1. AI answer

    2026-11-27T22:36:34.3266667+00:00

    Retry the least-privilege App Folder request through the case-sensitive special/approot route without deferCommit; this directly tests whether deferred completion is the rejected part while retaining Files.ReadWrite.AppFolder.

    1. Isolate the rejected feature

    Address the verified child folder relative to approot:

    POST /v1.0/me/drive/special/approot:/<child-path>/CH-1102.docx:/createUploadSession
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "item": {
        "name": "CH-1102.docx",
        "fileSize": 39154,
        "@microsoft.graph.conflictBehavior": "fail"
      }
    }
    

    approot is case-sensitive. The App Folder documentation says Files.ReadWrite.AppFolder restricts the app to this folder and allows operations on its contents, including uploads.^1^

    Interpret the result as follows:

    • Session returned: ordinary session creation works under the scoped folder; deferCommit is the discriminating input.
    • Same 400: test the same target with a freshly issued delegated Files.ReadWrite token. This is a controlled comparison, not proof of the backend cause.
    • Different error: preserve the complete response and correlation headers.

    Do not retry the existing request unchanged: a deterministic 400 is not a transient upload error.

    Published permission contract

    The action-specific createUploadSession permission table lists delegated Files.ReadWrite as the least-privileged permission for personal Microsoft accounts; it does not list Files.ReadWrite.AppFolder.^2^

    Consequently:

    • General App Folder documentation indicates that uploads within approot are supported.
    • The createUploadSession contract does not establish that this particular action—especially Personal OneDrive deferred completion—is supported with only Files.ReadWrite.AppFolder.
    • That omission establishes the published support contract, but it does not prove that permission handling caused this specific 400. Only service telemetry can trace the rejection.

    If the non-deferred App Folder request still fails, consent delegated Files.ReadWrite, acquire a new access token containing that scope, and repeat the request. Success would validate the documented general flow, but would not establish deferred-commit support under Files.ReadWrite.AppFolder.

    Documented Personal OneDrive deferred sequence

    Under the documented delegated permission, create the session with:

    POST /v1.0/me/drive/items/{parentItemId}:/CH-1102.docx:/createUploadSession
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "item": {
        "name": "CH-1102.docx",
        "fileSize": 39154,
        "@microsoft.graph.conflictBehavior": "fail"
      },
      "deferCommit": true
    }
    

    The path filename must match the body filename. Upload the 39,154 bytes to the returned preauthenticated URL without an Authorization header:

    PUT {uploadUrl}
    Content-Length: 39154
    Content-Range: bytes 0-39153/39154
    
    <39154 bytes>
    

    For Personal OneDrive, explicit completion is a Graph PUT using @microsoft.graph.sourceUrl; the zero-length POST completion method is only supported by OneDrive for Business and SharePoint.^2^

    Use the documented parent-path form:

    PUT /v1.0/me/drive/root:/<path-to-parent>
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
      "name": "CH-1102.docx",
      "@microsoft.graph.conflictBehavior": "fail",
      "@microsoft.graph.sourceUrl": "{uploadUrl}"
    }
    

    If another item acquires that name, the documented conflict outcome is 409 Conflict with nameAlreadyExists. However, the published source-URL commit example documents If-Match, not If-None-Match: *. Therefore, an additional atomic create-only guarantee from If-None-Match: * cannot be confirmed for this commit operation. Keep conflict behavior fail, but obtain Microsoft confirmation before relying on that header as a supported concurrency precondition.

    Service-side trace

    Escalate with the raw headers/body and these exact correlation points:

    • Primary Graph request ID: [GUID]
    • Client request ID: [GUID]
    • HTTP Date: Fri, 27 Nov 2026 21:29:25 GMT
    • Client UTC interval: 2026-11-27T21:29:25.147Z–2026-11-27T21:29:26.502Z
    • Earlier Graph request ID: [GUID]
    • Earlier approximate UTC time: 2026-11-27T20:53:42.709Z

    Explicitly note that the recorder normalized the nested error date and that correlation should use the HTTP Date and client UTC interval.


    References

    1. Using app folder in OneDrive and SharePoint
    2. driveItem: createUploadSession - Microsoft Graph v1.0 | Microsoft Learn
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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