Ravi Anand
Ravi Anand

Reputation: 5534

How to iterate Sharepoint site's document library items via Microsoft Graph API?

I have been trying to iterate through items under a document lib and a folder under a document lib in Sharepoint using Microsoft Graph API V1.0 and Beta too.

I can list doc lib using following request:

https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/FOA/BD:/drives

but I can't iterate through items under a specific drive under above path.

After a long research I tried with beta all the way to list all items under a drive still no result:

https://graph.microsoft.com/beta/sites/mysite.sharepoint.com:/foa/bd:/lists/Budget/

I followed Get an item in a list, but still no success.

Upvotes: 1

Views: 2056

Answers (1)

Brian Smith
Brian Smith

Reputation: 1656

You are close. Using the first link getting the list of drives, copy the drive-id of the drive which you want to retrieve the documents. Then you would use the following endpoint:

https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children

I answered a similar question with more detail for getting children items using Graph v1.0.

Upvotes: 3

Related Questions