Wednesday, 5 December 2018

SharePoint Files API for Microsoft Graph

SharePoint Files API for Microsoft Graph

SharePoint CSOM,REST provides wonderful ways to create,read,update and delete files/folder from a SharePoint library.

This article uses Microsoft Graph to do the CRUD operations on the Shared Documents library in a SharePoint site.

List all Document Libraries/Drives
https://graph.microsoft.com/v1.0/sites/root/drive

List Document with name Documents Document Library
https://graph.microsoft.com/v1.0/sites/root/drive?$filter name eq 'Documents'

List items in a library
https://graph.microsoft.com/v1.0/sites/root/drive/root/children

Get a particular item by ID
https://graph.microsoft.com/v1.0/sites/root/drive/items/01TNKEB3QXIEIZFXVPVJDYAAXQEGUVUMR5

Get a particular item by Path
https://graph.microsoft.com/v1.0/sites/root/drive/items/root:/FileName.txt

Create a Folder
POST request
Path:https://graph.microsoft.com/v1.0/sites/{siteid}/root/children
Data:{
  "name": "sample2",
  "folder": { },
  "@microsoft.graph.conflictBehavior": "rename"
}





No comments:

Post a Comment