Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all SharePoint files and folders of a drive using Microsoft Graph API

My problem is: if I call https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/root/children all I get are the top-level items of that drive.

How can I achieve to get all the subfolders and files of the drive?

like image 537
xilopaint Avatar asked Feb 02 '19 19:02

xilopaint


People also ask

How do you get a SharePoint list data from a graph API?

GraphServiceClient graphClient = new GraphServiceClient( authProvider ); var queryOptions = new List<QueryOption>() { new QueryOption("expand", "fields(select=Name,Color,Quantity)") }; var items = await graphClient. Sites["{site-id}"]. Lists["{list-id}"].

How do I use Microsoft Graph downloadUrl?

graph. downloadUrl property on the DriveItem. To download the contents of the file your application will need to follow the Location header in the response. Many HTTP client libraries will automatically follow the 302 redirection and start downloading the file immediately.


1 Answers

I found that the below endpoint retrieves all files and folders in a library. The result will be paged, with a standard page size of 200 items.

/drives/{drive-id}/list/items
like image 125
Gijs Avatar answered Sep 18 '22 13:09

Gijs