pretzelb
pretzelb

Reputation: 1221

Microsoft Graph API returns 400 URL specified is invalid with /drive/root/children

I am trying to use MS Graph API to read files from a SharePoint form library but while the drives command works any combination to get the files fails. It should be noted I am the owner of the site with full permissions. Using the online Graph explorer tool, and granting the permissions for files.read.all and sites.read.all the command to get the default drive (documents) works:

https://graph.microsoft.com/v1.0/sites/myportal.sharepoint.com:/sites/mysite:/drive

According to the documentation link the next command should show the files in the default drive:

https://graph.microsoft.com/v1.0/sites/myportal.sharepoint.com:/sites/mysite:/drive/root/children

However the explorer throws the 400 error saying "Url specified is invalid." Same thing happens if I try to enter the folder ID.

Is there an error in the permissions or the URL or could the online explorer tool be limited?

Upvotes: 0

Views: 810

Answers (1)

Lee
Lee

Reputation: 5493

To list SharePoint library(drive), use

https://graph.microsoft.com/v1.0/sites/siteid/drive/root/children

Test demo:

enter image description here

Upvotes: 1

Related Questions