The Microsoft Graph API is driving me nuts. I am trying and reading for hours and still can't get it to work.
I work with Sharepoint which contains a subsite, where there is DocumentLibrary with serveral folders.
I search the API: (https://graph.microsoft.com/v1.0/search/query)
"hits": [
{
"hitId": "01XPDM72T7SCIOG6BP4BAYQ5QI5RFFAESK",
"rank": 1,
"summary": "<c0>test</c0><ddd/><c0>test</c0><ddd/>",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 4,
"id": "3",
"createdDateTime": "2021-01-08T12:11:12Z",
"lastModifiedDateTime": "2021-01-08T12:11:12Z",
"name": "test.txt",
"webUrl": "https://tenant.sharepoint.com/sites/SubSite/Gedeelde documenten/test.txt",
"fileSystemInfo": {
"createdDateTime": "2021-01-08T12:11:12Z",
"lastModifiedDateTime": "2021-01-08T12:11:12Z"
},
"lastModifiedBy": {
"user": {
"displayName": "Admin"
}
},
"parentReference": {
"driveId": "2",
"siteId": "1",
"sharepointIds": {
"listId": "[snip]",
"listItemUniqueId": "[snip]"
}
}
}
},
So far so good. I find a driveItem, and now want to get the contents.
in the parentReference I see driveId, siteId and id in the resource. to my knowledge:
{site-id} = 1;
{drive-id} = 2;
{item-id} = 3;
If I look at https://docs.microsoft.com/en-us/graph/api/driveitem-get I can use several functions.
I start with /sites/{site-id}/drive/items/{item-id}
and /drives/{drive-id}/items/{item-id}
Response:
"error": { "code": "itemNotFound", "message": "The resource could not be found.",
/sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem
Response:
"error": { "code": "itemNotFound", "message": "The specified list was not found",
Nothing works. Can someone please help me out?