I got a drive id
from a Microsoft Teams generated SharePoint site list using
https://graph.microsoft.com/v1.0/groups/group-id/sites/root/lists/list-id/drive
I can successfully get the details of the drive by calling:
https://graph.microsoft.com/beta/drives/drive-id
However, I am getting an invalid request error when trying to get the items of the drive
https://graph.microsoft.com/beta/drives/drive-id/items
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "0d83a954-ed79-4a4a-ae28-f963db4b6f2f",
"date": "2018-03-26T05:10:37"
}
}
}
You're URI is a little off. You can only use the items
path when referencing a specific DriveItem
(i.e. /drives/{id}/items/{id}
).
If you're looking for a collection of DriveItem
resources in a drive, you need to call /drives/{driveId}/{path}/children
. The {path}
is the folder you want to retrieve the catalog of DriveItem
resources from. For the "root" directory you can simply use root
:
https://graph.microsoft.com/v1.0/drives/{driveId}/root/children
Also, you generally shouldn't use the beta
version of Microsoft Graph. It can experience breaking changes without warning (and does). It isn't safe for production use.