How do you search personal OneDrive folders within your company account via Microsoft Graph API?

Robert Rose 0 Reputation points
2023-04-19T15:55:33.9433333+00:00

I'm trying to search my Personal OneDrive folder within my organization using the Microsoft Graph API. I have been successful using a POST call, https://graph.microsoft.com/v1.0/search/query to search for a specific file(s) saved to my company's Sharepoint but when I move that file into my Personal OneDrive folder this POST call comes back with errors.

Microsoft 365 and Office | OneDrive | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Diya Ahuja 5 Reputation points
    2023-06-30T18:05:46.27+00:00

    To search for files in your Personal OneDrive folder within your organization, you can use the Microsoft Graph API. You can use a POST call to the endpoint https://graph.microsoft.com/v1.0/search/query to search for a specific file(s). When the file is stored in a SharePoint site, the POST call should work fine. However, when the file is stored in your Personal OneDrive folder, you may need to use a GET call instead.

    You can also use the /me/drive/special/{name} endpoint to access special folders like the Documents, Photos, Camera Roll, App Root, and Music folders. This endpoint supports the $expand and $select OData query parameters to customize the response.

    For more information, please refer to the Microsoft Graph documentation.

    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.