drive: sharedWithMe
Namespace: microsoft.graph
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.
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.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
Delegated (personal Microsoft account) | Files.Read.All, Files.ReadWrite.All |
Application | Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All |
Note:
- A
/sharedWithMe
request succeeds withFiles.Read
orFiles.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. |
Request body
Do not 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 is an example of a request.
GET https://graph.microsoft.com/v1.0/me/drive/sharedWithMe
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 is an example of a request.
GET https://graph.microsoft.com/v1.0/drives/987def/items/987def!654
Response
The following is an example of 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"
}
}
Feedback
Submit and view feedback for