Muokkaa

Jaa


List children of a driveItem

Namespace: microsoft.graph

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.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
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.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
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 https://graph.microsoft.com/v1.0/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.