Drive 资源类型Drive resource type

命名空间:microsoft.graphNamespace: microsoft.graph

驱动器资源是表示用户的 OneDrive 或 SharePoint 中文档库的顶级对象。The drive resource is the top level object representing a user's OneDrive or a document library in SharePoint.

OneDrive 用户必须始终具有至少一个可用驱动器,即默认驱动器。没有 OneDrive 许可证的用户不能拥有可用的默认驱动器。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 表示形式JSON representation

下面是 Drive 资源的 JSON 表示形式。Here is a JSON representation of a Drive resource.

drive 资源派生自 baseItem 并继承该资源的属性。The drive resource is derived from baseItem and inherits properties from that resource.

  "id": "string",
  "createdBy": { "@odata.type": "microsoft.graph.identitySet" },
  "createdDateTime": "string (timestamp)",
  "description": "string",
  "driveType": "personal | business | documentLibrary",
  "following": [{"@odata.type": "microsoft.graph.driveItem"}],
  "items": [ { "@odata.type": "microsoft.graph.driveItem" } ],
  "lastModifiedBy": { "@odata.type": "microsoft.graph.identitySet" },
  "lastModifiedDateTime": "string (timestamp)",
  "name": "string",
  "owner": { "@odata.type": "microsoft.graph.identitySet" },
  "quota": { "@odata.type": "microsoft.graph.quota" },
  "root": { "@odata.type": "microsoft.graph.driveItem" },
  "sharepointIds": { "@odata.type": "microsoft.graph.sharepointIds" },
  "special": [ { "@odata.type": "microsoft.graph.driveItem" }],
  "system": { "@odata.type": "microsoft.graph.systemFacet" },
  "webUrl": "url"


属性Property 类型Type 说明Description
createdBycreatedBy identitySetidentitySet 识别创建项目的用户、设备或应用程序。只读。Identity of the user, device, or application which created the item. Read-only.
createdDateTimecreatedDateTime dateTimeOffsetdateTimeOffset 创建项的日期和时间。只读。Date and time of item creation. Read-only.
descriptiondescription StringString 提供驱动器的用户可见说明。Provide a user-visible description of the drive. 读写。Read-write.
driveTypedriveType StringString 说明了由该资源表示的驱动器的类型。OneDrive 个人版驱动器将返回 personal。OneDrive for Business 将返回 business。SharePoint 文档库将返回 documentLibrary。只读。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.
idid StringString 驱动器唯一标识符。只读。The unique identifier of the drive. Read-only.
lastModifiedBylastModifiedBy identitySetidentitySet 上次修改项目的用户、设备和应用程序的标识。只读。Identity of the user, device, and application which last modified the item. Read-only.
lastModifiedDateTimelastModifiedDateTime dateTimeOffsetdateTimeOffset 上次修改项目的日期和时间。只读。Date and time the item was last modified. Read-only.
namename stringstring 项目名称。读写。The name of the item. Read-write.
所有者owner identitySetidentitySet 可选。拥有此驱动器的用户帐户。只读。Optional. The user account that owns the drive. Read-only.
配额quota 配额quota 可选。有关驱动器的存储空间配额的信息。只读。Optional. Information about the drive's storage space quota. Read-only.
sharepointIdssharepointIds sharepointIdssharepointIds 返回对 SharePoint REST 兼容性有用的标识符。只读。Returns identifiers useful for SharePoint REST compatibility. Read-only.
systemsystem systemFacetsystemFacet 如果存在,则表示这是系统管理的驱动器。If present, indicates that this is a system-managed drive. 只读。Read-only.
WebUrlwebUrl string (url)string (url) 在浏览器中显示此资源的 URL。只读。URL that displays the resource in the browser. Read-only.


关系Relationship 类型Type 说明Description
followingfollowing DriveItem 集合DriveItem collection 用户关注的项列表。The list of items the user is following. 仅适用于 OneDrive for Business 中。Only in OneDrive for Business.
itemsitems DriveItem 集合DriveItem collection 驱动器中包含的所有项。只读。可为 NULL。All items contained in the drive. Read-only. Nullable.
rootroot DriveItemDriveItem 驱动器的根文件夹。只读。The root folder of the drive. Read-only.
specialspecial DriveItem 集合DriveItem collection OneDrive 中可用的公用文件夹的集合。Collection of common folders available in OneDrive. 只读。Read-only. 可为 Null。Nullable.
listlist ListList 适合于 SharePoint 中的驱动器,基本文档库列表。For drives in SharePoint, the underlying document library list. 只读。Read-only. 可为 Null。Nullable.


常见任务Common task HTTP 方法HTTP method
获取其他驱动器的驱动器元数据Get Drive metadata of another Drive GET /drives/{drive-id}
获取用户默认驱动器的根文件夹Get root folder for user's default Drive GET /drive/root
列出驱动器下的子项List children under the Drive GET /drive/root/children
列出驱动器中所有项的变更List changes for all Items in the Drive GET /drive/root/delta
列出用户的关注 driveItemsList user's followed driveItems Get /drive/followed
搜索驱动器中的项Search for Items in the Drive GET /drive/root/search
访问特殊文件夹Access special folder GET /drive/special/{name}

在上表中,各示例使用的是 /drive,但其他路径也同样有效。In the previous table, the examples use /drive, but other paths are valid too.