Skip to content

Latest commit

 

History

History
200 lines (142 loc) · 7.88 KB

driveitem-list-children.md

File metadata and controls

200 lines (142 loc) · 7.88 KB
author description ms.date title ms.localizationpriority ms.subservice doc_type
spgraph-docs-team
Return a collection of driveItems in the children relationship of a driveItem.
09/10/2017
List children of a driveItem
medium
sharepoint
apiPageType

List children of a driveItem

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

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.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

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

Header 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

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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/root/children

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


List children of a driveItem with a known path

GET https://graph.microsoft.com/beta/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 is 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.