Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph API - /drive/root/children always empty, even though I have files in my onedrive

I'm trying to use the Microsoft Graph API to List Children by Getting access without a user

I have built my URL as you would expect:

https://graph.microsoft.com/v1.0/edffcd1c-e5b2-42f2-b554-XXXXXXXXX/drive/root/children

Where edffcd1c-e5b2-42f2-b554-XXXXXXXXX is the user ID of whom I'm trying to list the files.

Yet when I call this I get an empty result every time:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drive/root/children",
    "value": []
}

Why is that?

UPDATE: It seems that this API is only returning files from the Sharepoint account... not the OneDrive account. I already have access to the Sharepoint files from the Sharepoint API's themselves. Is there a way to get OneDrive files from the Microsoft Graph API?

This URL https://dev.onedrive.com/README.htm seems to state that we should be able to do this.

like image 693
Nicholas DiPiazza Avatar asked Dec 11 '25 17:12

Nicholas DiPiazza


1 Answers

Is there a way to get OneDrive files from the Microsoft Graph API?

Yes, there is: you must use the scope Files.Read.All or Files.ReadWrite.All

then, your requests to /drive/root/children will no longer return an empty array.

like image 145
JPR Avatar answered Dec 13 '25 10:12

JPR