The 'description' property caused OneDrive Graph API calls to fail when using accounts created before 2019/11.

QA1 5 Reputation points
2024-10-03T09:41:40.33+00:00

Following "https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession?view=odsp-graph-online" to call OneDrive graph api.

Account "A" was created before 2019/11,

Account "B" was created recently.

Request1:

{
  "item": {
    "@microsoft.graph.conflictBehavior": "rename",
    "description": "",
    "fileSystemInfo": {"@odata.type": "microsoft.graph.fileSystemInfo"},
    "name": "ttttt.jpg"
  } 
}


If using account "A", the response is as follows:

{
  "error": {
    "code": "invalidRequest",
    "message": "Invalid request",
    "innerError": {
      "date": "2024-09-30T12:52:59",
      "request-id": "9c768b04-0dfd-41d1-a3f0-69c223536fa6",
      "client-request-id": "9c768b04-0dfd-41d1-a3f0-69c223536fa6"
    }
  }
}

If using account "B", the response is as follows:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
  "expirationDateTime": "2024-10-05T13:17:50.988Z",
  "nextExpectedRanges": ["0-"],
  "uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}

Now just remove "description" from the request.

Request2:

{
  "item": {
    "@microsoft.graph.conflictBehavior": "rename",
    "fileSystemInfo": {"@odata.type": "microsoft.graph.fileSystemInfo"},
    "name": "ttttt.jpg"
  }
}

If using account "A", the response is as follows:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
  "expirationDateTime": "2024-10-05T13:17:50.988Z",
  "nextExpectedRanges": ["0-"],
  "uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}


If using account "B", the response is as follows:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
  "expirationDateTime": "2024-10-05T13:17:50.988Z",
  "nextExpectedRanges": ["0-"],
  "uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}

Why does the "description" in the request cause the request to fail for account "A" but work for account "B".

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,289 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,154 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yakun Huang-MSFT 6,575 Reputation points Microsoft Vendor
    2024-10-04T01:48:18.7166667+00:00

    Hello QA1,

    Thank you for reaching out to Microsoft Support!

    According to the documentation, the description parameter only supports personal accounts, so please check if Account "A" is a personal account.

    User's image

    See this document for more details.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


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.