List children of a driveItem
Return a collection of DriveItems in the children relationship of a DriveItem.
DriveItems with a non-null folder or package facet can have one or more child DriveItems.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
Delegated (personal Microsoft account) | Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All |
Application | Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
HTTP request
GET /drives/{drive-id}/items/{item-id}/children
GET /groups/{group-id}/drive/items/{item-id}/children
GET /me/drive/items/{item-id}/children
GET /sites/{site-id}/drive/items/{item-id}/children
GET /users/{user-id}/drive/items/{item-id}/children
Optional query parameters
This method supports the $expand
, $select
, $skipToken
, $top
and $orderby
OData query parameters to customize the response.
Optional request headers
Name | Value | Description |
---|---|---|
if-none-match | etag | If this request header is included and the eTag (or cTag) provided matches the current tag on the file, an HTTP 304 Not Modified response is returned. |
Examples
List children in the root of the current user's drive
To retrieve files in the root of the drive, use the root
relationship on the drive, then access the children relationship.
GET /me/drive/root/children
List children of a DriveItem with a known ID
To retrieve files in the root of the drive, use the root
relationship on the drive, then access the children relationship.
GET /drives/{drive-id}/items/{item-id}/children
List children of a DriveItem with a known path
GET /drives/{drive-id}/root:/{path-relative-to-root}:/children
Response
If successful, this method returns the list of items in the children collection of the target item. The children collection will be composed of driveItem resources.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{"name": "myfile.jpg", "size": 2048, "file": {} },
{"name": "Documents", "folder": { "childCount": 4} },
{"name": "Photos", "folder": { "childCount": 203} },
{"name": "my sheet(1).xlsx", "size": 197 }
],
"@odata.nextLink": "https://..."
}
Note: If a collection exceeds the default page size (200 items), the @odata.nextLink property is returned in the response to indicate more items are available and provide the request URL for the next page of items.
You can control the page size through optional query string parameters
Error responses
See Error Responses for more info about how errors are returned.