Issue with MS Graph API search functionality returning inconsistent data

Diego Mota 0 Reputation points
2025-02-11T08:42:33.3933333+00:00

Hello there, 

I'm working with an add-in solution in my company and we have encountered an issue while trying to locate a file on a customer’s drive using the Microsoft Graph API. Specifically, neither of the MS search endpoints we use is able to find or return the file. However, if we fetch a list of the user’s files separately, we can locate the file in the list (this was tested with my personal email and business email).

Here are the API details:

API version: https://graph.microsoft.com/v1.0

Endpoints used:

/me/drive/search

/search/query

The issue is reproducible with a file that was previously found but is no longer returned for some reason. Also, we are able to write to these files e.g. using the add-in so the file is not read-only.

Additionally, we observed the same behavior in the Graph Explorer sandbox: https://developer.microsoft.com/en-us/graph/graph-explorer

For example:

  • The file appears in the responses from the "list drive files" and "recent drive files" endpoints.
  • However, the "search my drive" endpoint does not return the file.

Looking forward to any guidance or suggestions you may have on resolving this issue.Hello there, 

Thanks in advance.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,044 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 45,186 Reputation points
    2025-02-11T09:49:12.2533333+00:00

    Hi @Diego Mota

    Have you tried the GET /me/drive/root/search(q='{search-text}') API? I just did a quick test locally and it worked fine for me.

    User's image

    Source: https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


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.