Feb 01 2021 04:00 AM - edited Feb 08 2021 12:48 AM
Hey,
i wanna list all the items that are in a SharePoint library which is the root library of a Teamsite.
In the Graph API documentation i have found the following to "List children of a driveItem". Which seems to be what i need. I'm using the Graph Explorer v1.0, i get an empty value.
GET /drives/{drive-id}/items/{item-id}/children
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('[Redacted]')/items('[Redacted]')/children",
"value": []
}
When getting the metadata of a drive (Get a DriveItem resource) I get the follwoing result.
GET /drives/{drive-id}/items/{item-id}/
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('[Redacted]')/items/$entity",
"createdDateTime": "2018-06-29T06:58:41Z",
"id": "[Redacted]",
"lastModifiedDateTime": "2021-02-01T11:44:01Z",
"name": "root",
"webUrl": "[Redacted]",
"size": 14251577828,
"parentReference": {
"driveId": "[Redacted]",
"driveType": "documentLibrary"
},
"fileSystemInfo": {
"createdDateTime": "2018-06-29T06:58:41Z",
"lastModifiedDateTime": "2021-02-01T11:44:01Z"
},
"folder": {
"childCount": 17
},
"root": {}
}
So instead of the first result to be empty I'm expecting to get at least the 17 Children on the first level.
I'd really appreciate any pointers as to what I'm doing wrong.
Thanks
EDIT:
I created a new Teamsite in that Tenant and got the same results.
/drives/[Drive-id-Redacted]/items/[item-id-redacted]/children
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('Redacted')/items('Redacted')/children",
"value": []
}
I also did the same exact steps on another Tenant. Were i got the expected results. Everything on the first level of the document library was returned (empty folders, folders with content & files).
GET drives/[drive-id-Redacted]/items/[item-id-Redacted]/children
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21AkpyLC5wkUKil3rDWQGKATkY1dsy_8VBn4bwuhbxbzG5iis7JuCiTYx7InpDx1E7')/items('0165NKSCF6Y2GOVW7725BZO354PWSELRRZ')/children",
"value": [
{
"createdDateTime": "2021-02-01T08:07:32Z",
"eTag": "\"{Redacted},1\"",
"id": "Redacted",
"lastModifiedDateTime": "2021-02-01T08:07:32Z",
"name": "_Test_Folder",
"webUrl": "https://Redacted.sharepoint.com/sites/PowerAppsFunktionen/Freigegebene%20Dokumente/_Test_Folder",
"cTag": "\"c:{Redacted},0\"",
"size": 0,
"createdBy": {
"user": {
"email": "mmuster@Redacted.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"lastModifiedBy": {
"user": {
"email": "mmuster@Redacted.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"parentReference": {
"driveId": "Redacted",
"driveType": "documentLibrary",
"id": "Redacted",
"path": "/drives/Redacted/root:"
},
"fileSystemInfo": {
"createdDateTime": "2021-02-01T08:07:32Z",
"lastModifiedDateTime": "2021-02-01T08:07:32Z"
},
"folder": {
"childCount": 0
}
},
{
"createdDateTime": "2021-01-14T08:14:40Z",
"eTag": "\"{Redacted},1\"",
"id": "Redacted",
"lastModifiedDateTime": "2021-01-14T08:14:40Z",
"name": "Ordner",
"webUrl": "https://Redacted.sharepoint.com/sites/PowerAppsFunktionen/Freigegebene%20Dokumente/Ordner",
"cTag": "\"c:{Redacted},0\"",
"size": 367581,
"createdBy": {
"user": {
"email": "mmuster@Redacted.onmicrosoft.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"lastModifiedBy": {
"user": {
"email": "mmuster@Redacted.onmicrosoft.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"parentReference": {
"driveId": "Redacted",
"driveType": "documentLibrary",
"id": "Redacted",
"path": "/drives/Redacted/root:"
},
"fileSystemInfo": {
"createdDateTime": "2021-01-14T08:14:40Z",
"lastModifiedDateTime": "2021-01-14T08:14:40Z"
},
"folder": {
"childCount": 22
}
},
{
"@microsoft.graph.downloadUrl": "https://Redacted.sharepoint.com/sites/PowerAppsFunktionen/_layouts/15/download.aspx?Redacted&ApiVersion=2.0",
"createdDateTime": "2020-11-05T22:17:07Z",
"eTag": "\"{Redacted},9\"",
"id": "Redacted",
"lastModifiedDateTime": "2020-11-06T10:33:09Z",
"name": "Mappe.xlsx",
"webUrl": "https://Redacted.sharepoint.com/sites/PowerAppsFunktionen/_layouts/15/Doc.aspx?sourcedoc=%7BRedacted%7D&file=Mappe.xlsx&action=default&mobileredirect=true",
"cTag": "\"c:{Redacted},15\"",
"size": 23064,
"createdBy": {
"user": {
"email": "mmuster@Redacted.onmicrosoft.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"lastModifiedBy": {
"application": {
"id": "Redacted",
"displayName": "App Service"
},
"user": {
"email": "mmuster@Redacted.onmicrosoft.com",
"id": "Redacted",
"displayName": "Max Muster"
}
},
"parentReference": {
"driveId": "Redacted",
"driveType": "documentLibrary",
"id": "Redacted",
"path": "/drives/Redacted/root:"
},
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
"quickXorHash": "Redacted"
}
},
"fileSystemInfo": {
"createdDateTime": "2020-11-05T22:17:07Z",
"lastModifiedDateTime": "2020-11-06T10:33:09Z"
}
},
[...]
]
}
Has anyone had a similar experience?
In the first Library i thought it might have to do with the number of items in the Library (about 25.000). But the others are all under 50 items.
Feb 09 2021 02:42 AM
Mar 29 2021 08:47 AM
Oct 02 2022 10:28 AM
@marwanzo you probably already found where, this reference tells you about required permissions: Microsoft Graph permissions reference - Microsoft Graph | Microsoft Learn
Jan 27 2023 06:41 PM
@Carry4IT Megens where I can fin them? Thanks
Mar 02 2023 01:28 AM - edited Mar 02 2023 01:29 AM
I'm not sure what you want to know. I merely pointed out an generic article on Microsoft Graph permissions. Do start at the overview if you are interested in those.
But this thread was about Graph Explorer itself and permissions given. Mind you, you'll need to sign in to Graph Explorer. This then prompts you to provide permissions to Graph Explorer for your logged in user and/or asks to grant permissions on behalf of the organisation.
Is that what you were looking for?