List available drives

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

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

List a group's drives

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

HTTP request

GET /groups/{groupId}/drives

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var drives = await graphClient.Groups["{groupId}"].Drives
	.Request()
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.

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

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var drives = await graphClient.Sites["{siteId}"].Drives
	.Request()
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.

List a user's drives

GET /users/{userId}/drives

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var drives = await graphClient.Users["{userId}"].Drives
	.Request()
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.

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.

Response

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

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

{
  "value": [
    {
      "id": "942CAEB0-13AE-491B-85E4-7557CDC0F25F",
      "driveType": "documentLibrary",
      "name": "Shared Documents",
      "owner": {
        "user": {
          "id": "AE2A1EE9-81A7-423C-ABE4-B945F47509BB",
          "displayName": "Ryan Gregg"
        }
      }
    },
    {
      "id": "C1CD3ED9-0E98-4B0B-82D3-C8FB784B9DCC",
      "driveType": "documentLibrary",
      "name": "Contoso Project Files",
      "owner": {
        "user": {
          "id": "406B2281-18E8-4416-9857-38C531B904F1",
          "displayName": "Daron Spektor"
        }
      }
    }
  ]
}

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var drives = await graphClient.Me.Drives
	.Request()
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.

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.