#DevHack: Create SharePoint library with the Microsoft Graph
Elio Struyf

Elio Struyf @estruyf

About: Elio Struyf is an independent Solutions Architect, Blogger, and Speaker. Loves stickers - if you want stickers, get them at https://pyod.shop.

Location:
Antwerp
Joined:
Jul 10, 2020

#DevHack: Create SharePoint library with the Microsoft Graph

Publish Date: Nov 27 '20
1 0

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.

Info: Documentation to create a new list

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"
  }
}
Enter fullscreen mode Exit fullscreen mode

Info: More information about all properties can be found here: JSON body representation.

That is it for this #DevHack

Comments 0 total

    Add comment