1
votes

I'm trying to find a way in Sharepoint Graph API how download file in Document library that are not listed as drive (Site Pages and others). If I enumerating lists, I see "Site Pages" in lists:

https://graph.microsoft.com/v1.0/sites/<site id>/lists

I even can enumerate item in list :

https://graph.microsoft.com/v1.0/sites/<site id>/lists/<list id>/items

But I can't find a way to get a content (download) those items (files). All available url to download file (get content) are next:

GET /drives/{drive-id}/items/{item-id}/content
GET /groups/{group-id}/drive/items/{item-id}/content
GET /me/drive/root:/{item-path}:/content
GET /me/drive/items/{item-id}/content
GET /sites/{siteId}/drive/items/{item-id}/content
GET /users/{userId}/drive/items/{item-id}/content

Doesn't provides an ability to get the content. I can't find a way to get drive id for list, and there's no url to get content from list (even if it's documents library).

Please advise. Thanks

2

2 Answers

2
votes

You can call the following endpoints to retrieve:

  1. all document libraries on a site
  2. items in a document library (from root)
  3. download the content of an item

This may not be the most efficient set of queries but I successfully tested in my lab tenant.

  1. https://graph.microsoft.com/(version)/sites/(site-id)/drives

  2. https://graph.microsoft.com/(version)/sites/(site-id)/drive/(drive-id)/root/children

  3. https://graph.microsoft.com/(version)/sites/(site-id)/drive/(drive-id)/items/(item-id)/content

-1
votes

The drive resource represents a user's OneDrive or a document library in SharePoint. while site page is a page library, not document library, this is why it's not returned in drive request.

We suggest you get the file using SharePoint Rest API.