question

KennelMichael-2949 avatar image
0 Votes"
KennelMichael-2949 asked KennelMichael-2949 answered

Can't access sharepoint lists or drives through graph api

Hello, I'm trying to access a list and some drives on one of my organization's sharepoint sites via the graph api. I can successfully get the site information from the '/sites/ endpoint. When I try to get lists or drives the request comes back successful but with an empty array for the value.
200319-image.png


Sending a request for the specific list/drive gives a 404 response, which is not entirely unexpected since it didn't list anything in the previous request.
200320-image.png

I've tried creating multiple lists in an effort to get any of them to show up with no luck. Is there a permissions setting I'm missing somewhere to allow these items to be fetched by the graph API?

office-sharepoint-onlinemicrosoft-graph-applicationsmicrosoft-graph-explorer
image.png (38.5 KiB)
image.png (48.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ShivamDhiman-1582 avatar image
2 Votes"
ShivamDhiman-1582 answered

Hi @KennelMichael-2949

I am able to replicate your issue. Empty lists usually means that required permissions are missing. To get list items from SharePoint sites you need following permissions.

200412-permissions2.png

Please refer to this documentation.

After adding all the required permissions I am able to get desired result.

Result
200403-result1.png

Hope this helps,

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".


permissions2.png (33.6 KiB)
result1.png (96.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KennelMichael-2949 avatar image
1 Vote"
KennelMichael-2949 answered

Perfect, thank you @ShivamDhiman-1582. I had the wrong permission selected for the application I was building.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.