Share via

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

Dharnik Shah 1 Reputation point
2021-05-27T05:28:30.443+00:00

I am getting access token from user with the scopes that I need which are Files.Read as shown below
stdClass Object
(
[token_type] => Bearer
[scope] => Files.Read Files.Read.All Files.ReadWrite.All Mail.Read Sites.Read.All User.Read profile openid email
[expires_in] => 3599
[ext_expires_in] => 3599
[access_token] => eyJ0eXAiOiJKV1QiLCJub25j // i have shorten this access token
[refresh_token] => 0.AWQA4RhkkXBq2kqvIbqr05RTbr8vC // i have shorten this refresh token
)

My problem is when I call /me/drive/root/children API it gives me empty result as shown below,

stdClass Object
(
[@odata.context] => https://graph.microsoft.com/v1.0/$metadata#users('ae496a8e-f1b1-4e1c-83df-xxxxxxxxxxxx')/drive/root/children
[value] => Array
(
)

)

From the portal, I have given permission for Files.Read Files.Read.All Files.ReadWrite.All. But then also getting empty value. I have files in my one drive.

Microsoft Security | Microsoft Authenticator
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.