列出与已登录用户共享的项目List items shared with the signed-in user

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

检索已与驱动器所有者共享的 DriveItem 资源的集合。Retrieve a collection of DriveItem resources that have been shared with the owner of the Drive.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限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.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.AllFiles.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) Files.Read.All、Files.ReadWrite.AllFiles.Read.All, Files.ReadWrite.All
应用程序Application Files.Read.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.AllFiles.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All

注意: 虽然 /sharedWithMe 请求可通过 Files.Read 或 Files.ReadWrite 权限成功发出,但一些属性可能会丢失。Note: while the /sharedWithMe request will succeed with Files.Read or Files.ReadWrite permissions, some properties may be missing. 此外,如果没有 All 权限之一,则无法访问从此 API 返回的共享项。Additionally, without one of the All permissions, shared items returned from this API will not be accessible.

HTTP 请求HTTP request

GET /me/drive/sharedWithMe

响应Response

此方法返回 DriveItem 资源的集合,这些资源包含已与驱动器所有者共享的 DriveItem 资源。在此示例中,由于此驱动器是用户的默认驱动器,此方法将返回与已登录用户共享的项目。This returns a collection of DriveItem resources which contain the DriveItem resources shared with the owner of the drive. In this example, since the drive is the user's default drive, this returns items shared with the signed in user.

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

{
  "value": [
    {
      "id": "1312abc",
      "remoteItem": {
        "id": "1991210caf!192",
        "name": "March Proposal.docx",
        "file": { },
        "size": 19121,
        "parentReference": {
          "driveId": "1991210caf",
          "id": "1991210caf!104"
        }
      }
    },
    {
      "id": "1312def",
      "remoteItem": {
        "id": "1991210caf!1991",
        "name": "Team Roster.xlsx",
        "file": { },
        "size": 37619,
        "parentReference": {
          "driveId": "1991210caf",
          "id": "1991210caf!104"
        }
      }
    }
  ]
}

注解Remarks

sharedWithMe 操作返回的 driveItem 始终都将包括 remoteItem 方面,这表明它们是其他驱动器中的项目。若要访问共享的 DriveItem 资源,你将需要使用 remoteItem 中提供的信息发出请求,信息格式如下:DriveItems returned from the sharedWithMe action will always include the remoteItem facet which indicates they are items from a different drive. To access the shared DriveItem resource, you will need to make a request using the information provided in remoteItem in the following format:

GET /drives/{remoteItem-driveId}/items/{remoteItem-id}