Skip to content

Latest commit

 

History

History
188 lines (140 loc) · 5.82 KB

File metadata and controls

188 lines (140 loc) · 5.82 KB
author spgraph-docs-team
ms.date 09/10/2017
title List Drives
ms.localizationpriority high
ms.subservice sharepoint
description Retrieve the list of Drive resources available for a target User, Group, or Site.
doc_type apiPageType

List available drives

Namespace: microsoft.graph

Retrieve the list of Drive resources available for a target User, Group, or Site.

[!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

List a group's drives

To list the document libraries for a group, your app requests the drives relationship on the Group.

GET /groups/{groupId}/drives

List a site's drives

To list the document libraries for a site, your app requests the drives relationship on the Site.

GET /sites/{siteId}/drives

List a user's drives

GET /users/{userId}/drives

List the current user's drives

GET /me/drives

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.

Response

If successful, this method returns a 200 OK response code and collection of Drive objects in the response body.

Examples

Request

GET /me/drives

[!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]


Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
    "value": [
        {
            "createdDateTime": "2017-07-27T02:41:36Z",
            "description": "",
            "id": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
            "lastModifiedDateTime": "2018-03-27T07:34:38Z",
            "name": "OneDrive",
            "webUrl": "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/Documents",
            "driveType": "business",
            "createdBy": {
                "user": {
                    "displayName": "System Account"
                }
            },
            "lastModifiedBy": {
                "user": {
                    "email": "MeganB@contoso.com",
                    "id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
                    "displayName": "Megan Bowen"
                }
            },
            "owner": {
                "user": {
                    "email": "MeganB@contoso.com",
                    "id": "48d31887-5fad-4d73-a9f5-3c356e68a038",
                    "displayName": "Megan Bowen"
                }
            },
            "quota": {
                "deleted": 0,
                "remaining": 1099217021300,
                "state": "normal",
                "total": 1099511627776,
                "used": 294606476
            }
        }
    ]
}

Remarks

Most users will only have a single Drive resource.

Groups and Sites may have multiple Drive resources available.

Drives with the system facet are hidden by default. To list them, include system in your $select statement.