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

WMio Connectors 121 Reputation points
2020-10-20T12:55:06.32+00:00

Hi,

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

OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,269 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,619 questions
{count} vote

4 answers

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2020-10-21T10:02:37.857+00:00

    Hi @WMio Connectors ,
    As I test about the /drives/{remoteItem-driveId}/items/{remoteItem-id} api,when the file is shared from different tenants, the api cannot be returned successfully, and the error reported is Invalid request.
    34061-success1.png34052-fail.png
    When I use mismatched remoteItem-driveId and remoteItem-id, the operation result will report the same error as yours.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Joseph Flack 1 Reputation point
    2021-01-01T23:51:54.087+00:00

    Same problem here. I have a script that is iterating over all of my folders in root of my drive. I then make an API call to get the children of each folder. When I do this for folders that are created by me as opposed to shared with me, I get a good result. But when I do this for folders shared with me, I get (a) a response with 0 items if I search using the items 'id' as returned from my previous query listing rot folders, or (b) an erroneous response stating not found / auth issue (idr) in the case that I use 'remoteItem' 'id'.

    0 comments No comments

  3. Damien Cuvillier 1 Reputation point
    2021-01-05T12:23:11.683+00:00

    Hello ! I have the exact same problem with "Item not found".

    We share (with permission API) a presentation from OneDrive with a specific user. When we want to connect programmatically with this specific user and try to access the document with this route /drives/{remoteItem-driveId}/items/{remoteItem-id} It doesn't work. I have tried a lot of things but I cant figure this out. Could someone help me ?

    The problem is always "Item not found".

    0 comments No comments

  4. Joseph Flack 1 Reputation point
    2021-01-05T19:11:10.74+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.