Skip to content

Latest commit

 

History

History
260 lines (202 loc) · 8.23 KB

File metadata and controls

260 lines (202 loc) · 8.23 KB
author spgraph-docs-team
description Get a list of driveItem objects shared with the owner of a drive.
title drive: sharedWithMe (deprecated)
ms.localizationpriority medium
ms.subservice sharepoint
doc_type apiPageType
ms.date 04/04/2024

drive: sharedWithMe (deprecated)

Namespace: microsoft.graph

Caution

The sharedWithMe API is deprecated and will operate in a degraded state until November, 2026, after which it will stop returning data.

Get a list of driveItem objects shared with the owner of a drive.

The driveItems returned from the sharedWithMe method always include the remoteItem facet that indicates they are items from a different drive.

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

Note:

  • A /sharedWithMe request succeeds with Files.Read or Files.ReadWrite permissions; however, some properties might be missing.
  • You can't access shared items returned from this API if the request doesn't contain one of the *.All permissions.

HTTP request

GET /me/drive/sharedWithMe

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

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

By default, this method returns items shared within your own tenant. To include items shared from external tenants, append ?allowexternal=true to a GET request.

Examples

Example 1: Get driveItems shared with me

The following example gets a collection of driveItem resources that are shared with the owner of the drive.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/me/drive/sharedWithMe

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

The following is an example of the response that returns items shared with the signed-in user, because the drive is the user's default drive.

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"
        }
      }
    },
    {
      "id": "1312ghi",
      "remoteItem": {
        "id": "987def!654",
        "name": "January Service Review.pptx",
        "file": { },
        "size": 145362,
        "parentReference": {
          "driveId": "987def",
          "id": "987def!321"
        }
      }
    }
  ]
}

Example 2: Get metadata about a shared driveItem object

The following example shows how to access metadata about the shared driveItem with the name January Service Review.pptx that requires a request using the driveId of the parentReference within the remoteItem object.

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/drives/987def/items/987def!654

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

The following example shows the response.

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

{
  "id": "987def!654",
  "name": "January Service Review.pptx",
  "file": { },
  "size": 145362,
  "parentReference": {
    "driveId": "987def",
    "id": "987def!321"
  }
}