Error using Graph API to create a folder in a Sharepoint DocumentLibrary

Tam, Will 0 Reputation points
2025-04-04T19:41:30.41+00:00

Why am I able to use the API to make a folder in the "default" Documents document library but get a 500 error when I try to make a folder in a different document library in the same site with the same permissions?

I'm able to use the Graph API to make a folder just fine using this POST:
https://graph.microsoft.com/v1.0/sites/thirteen.sharepoint.com,fca8d5a4-8bff-4008-9e51-14b4cc7f51fb/drive/items/children

The folder is created successfully using my access token etc, but in the default "Documents" document library. I have another document library in that site and when I attempt to make the folder with the item id for that library I get a 500 Exception -- 'general exception while processing'

https://graph.microsoft.com/v1.0/sites/thirteen.sharepoint.com,fca8d5a4-8bff-4008-9e51-14b4cc7f51fb/drive/items/b!pNWo_P-LCECeURS0zH9R-2WIm-ssxktDhSa5tveXuYEzbouZvS-0RooyWvc8UxJE/children

This is exactly how https://learn.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http says to make the request. I'm using the "id" value I get for the document library when I hit
https://graph.microsoft.com/v1.0/sites/thirteen.sharepoint.com,fca8d5a4-8bff-4008-9e51-14b4cc7f51fb/drives

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

1 answer

Sort by: Most helpful
  1. Rajat Vashistha-MSFT 1,535 Reputation points Microsoft External Staff
    2025-04-08T10:15:49.56+00:00

    Hi Tam, Will,

    Thank you for reaching out to Microsoft!

    We appreciate you sharing your solution for creating a folder in the "default" Document library. Below is the relevant Graph API endpoint:

    POST /sites/{site-id}/drives/{parent-item-id}/root/children

    Please note that "parent-item-id" refers to the drive ID.

    Your feedback about updating the "Create a new folder in a drive" documentation has been noted, and we will pass it along.

    As per the Microsoft Q&A forum's policy, users cannot accept their own answers. Therefore, I have added your solution as an answer. Kindly click "Accept Answer" and upvote it so that others facing similar issues can benefit from it.

    Thank you for contributing!

    0 comments No comments

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.