#DevHack: Create SharePoint library with the Microsoft Graph

API Development Microsoft Graph SharePoint
post

This post is over a year old, some of this information may be out of date.

When you are reading this, you are looking to create a SharePoint library from the Microsoft Graph. It is straightforward but a bit confusing because you will have to use the lists endpoint. When you are a SharePoint developer, we all learned that a list is not the same as a library, and lists get created under the /lists/ URL path. Document libraries are not.

When you want to create a new document library, you can perform the same call as mentioned in the create list documentation page instead of using the genericList template value. Use the documentLibrary value.

POST /sites/{site-id}/lists
Content-Type: application/json
{
"displayName": "YourLibraryName",
"list": {
"template": "documentLibrary"
}
}

That is it for this #DevHack

Building on Microsoft 365? Let's work together I help product teams with SharePoint Framework architecture, end-to-end testing and CI/CD. Get in touch →

Want the next article?

Subscribe to the RSS feed, or follow me where I share new posts.

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

I build developer tools · Microsoft 365 architect · Speaker

Loading...

Let's build together

All your AI coding agents in one window

Present from VS Code

Manage content in VS Code

See all my projects →