jerry_k
jerry_k

Reputation: 393

Get SharePoint list id from a SharePoint Drive item

I'm wondering if there is a way to get the SharePoint list id from a drive item data.

I know the opposite way is is possible with
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem

For example I'm using the enpoint GET /drives/{drive-id}/root/search(q='{search-text}') To search for files and folders within a SharePoint drive. This search returns details for the drive item. If a file exists I would like to update the corresponding list item, but I can't find a way to extract the list id for a drive Item data.

Upvotes: 2

Views: 3056

Answers (1)

user2250152
user2250152

Reputation: 20823

You can expand listItem property of driveItem

GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem?$expand=listItem
GET /drives/{drive-id}/items/{item-id}?$expand=listItem

Resource:

driveItem relationships

Upvotes: 3

Related Questions