"Item not found" error is returned when i try to get file details that has been shared by the external user

2.5k Views Asked by At

Shared with me API provides me the list of all files and folders that are shared by internal and external users. The Shared API URL is mentioned below https://learn.microsoft.com/en-us/graph/api/drive-sharedwithme?view=graph-rest-1.0&tabs=http

But when I try to access the shared DriveItem resource of the file that has been shared by the external user bypassing DriveID and File ID into the API /drives/{remoteItem-driveId}/items/{remoteItem-id} The API throws an error as -

{
"error": {
"code": "itemNotFound",
"message": "Item not found",
"innerError": {
"date": "2020-10-20T12:07:39",
"request-id": "5a3b3836-fe3e-450a-837e-1b3e962ac94b",
"client-request-id": "5a3b3836-fe3e-450a-837e-1b3e962ac94b"
}
}
}

But the Same API works fine with the file shared with Internal Users. Am I missing something here any help is greatly appreciated?

Regards, Kuldeep K

2

There are 2 best solutions below

1
Shiva Keshav Varma On

For external tenants make sure you append ?allowexternal=true according to the public document and then give a try.

1
Leah P On

I had the same problem when trying to get workbook info from an excel made by a colleague. I was initially using

https://graph.microsoft.com/v1.0/me/drive/items/{drive-item-id}/workbook/worksheets

and fixed it using:

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

The drive ID is under "parent reference" and in my case, the remote ID under "remoteItem" was the same as the first id listed.