Drive resource type

Important: APIs under the /beta version in Microsoft Graph are in preview and are subject to change. Use of these APIs in production applications is not supported.

The drive resource is the top level object representing a user's OneDrive or a document library in SharePoint.

OneDrive users will always have at least one drive available, their default drive. Users without a OneDrive license may not have a default drive available.

JSON representation

Here is a JSON representation of a drive resource.

The drive resource is derived from baseItem and inherits properties from that resource.

{
  "id": "string (identifier)",
  "driveType": "string",
  "owner": {"@odata.type": "microsoft.graph.identitySet"},
  "quota": {"@odata.type": "microsoft.graph.quota"},
  "sharepointIds": { "@odata.type": "microsoft.graph.sharepointIds" },

  /* relationships */
  "root": {"@odata.type": "microsoft.graph.driveItem" },
  "items": [ {"@odata.type": "microsoft.graph.driveItem" }],
  "list": {"@odata.type": "microsoft.graph.list" },
  "special": [ {"@odata.type": "microsoft.graph.driveItem" }],

  /* inherited from baseItem */
  "createdBy": { "@odata.type": "microsoft.graph.identitySet" },
  "createdDateTime": "datetime",
  "description": "string",
  "lastModifiedBy": { "@odata.type": "microsoft.graph.identitySet" },
  "lastModifiedDateTime": "datetime",
  "name": "string",
  "webUrl": "url"
}

Properties

Property Type Description
id String The unique identifier of the drive. Read-only.
createdBy identitySet Identity of the user, device, or application which created the item. Read-only.
createdDateTime dateTimeOffset Date and time of item creation. Read-only.
driveType String Describes the type of drive represented by this resource. OneDrive personal drives will return personal. OneDrive for Business will return business. SharePoint document libraries will return documentLibrary. Read-only.
lastModifiedBy identitySet Identity of the user, device, and application which last modified the item. Read-only.
lastModifiedDateTime dateTimeOffset Date and time the item was last modified. Read-only.
name string The name of the item. Read-write.
owner identitySet Optional. The user account that owns the drive. Read-only.
quota quota Optional. Information about the drive's storage space quota. Read-only.
sharepointIds sharepointIds Returns identifiers useful for SharePoint REST compatibility. Read-only.
webUrl string (url) URL that displays the resource in the browser. Read-only.

Relationships

Relationship Type Description
items driveitem collection All items contained in the drive. Read-only. Nullable.
list list The corresponding Document Library list for drives in SharePoint.
root driveitem The root folder of the drive. Read-only.
special driveitem collection Collection of common folders available in OneDrive. Read-only. Nullable.

Methods

The following methods are available for drive resources.

Method REST Path
Get user's default drive GET /me/drive
Get another user's drive GET /users/{user-id}/drive
Get root folder for a drive GET /drives/{drive-id}/root
List items in a drive GET /me/drive/root/children
List changes in a drive GET /me/drive/root/delta
Search items in a drive GET /me/drive/search(q='text')