Share via

Is MSGraph Search API reliable for discovery

Hung Wu 20 Reputation points
2026-02-20T00:09:42.5666667+00:00

Hi,

I am planning to use MSGraph Search API https://graph.microsoft.com/v1.0/search/query to discover every Sharepoint files assigned with a given sensitivity label. I will be using app permission with Sites.Read.All

Question:

  1. Is this API reliable for discover all files with this criteria? If the result is large (e.g. larger than 100k+).
    1. Is there a cap of total result (not page size)
    2. If not, what would be a reliable way for this?
  2. Is so, this API seems to require region field. What is the best way to discover all region?
Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Kha-N 8,255 Reputation points Microsoft External Staff Moderator
    2026-02-20T01:12:04.9433333+00:00

    Hi @HungWu,

    Welcome to Microsoft Q&A, and thank you very much for reaching out.

    Based on your description, the Q&A Assist response is generally correct. That said, I’d like to clarify a few points to better address your questions.

    First, according to Microsoft documentation, the Microsoft Graph Search API relies on the Microsoft Search index, which is designed for relevance-based discovery, not compliance-grade enumeration.

    User's image

    Additionally, Microsoft documentation notes that even when using refined queries with aggregations, the returned counts are approximate and do not represent an exact number of matches. Because of this behavior, the Search API is not reliable if your goal is to discover all files precisely, as results are approximations rather than a guaranteed complete set.

    User's image

    Because of this, the Search API should be considered best‑effort, not authoritative, for discovering all files that meet a specific compliance condition such as a sensitivity label.

    Regarding a cap on the total number of results, from my research, Microsoft does not document any explicit limit. As such, there is no confirmed maximum, but there is also no guarantee that paging will return every matching item, as the returned counts are approximate.

    For a more reliable approach, especially for compliance or sensitivity‑label scenarios, you may consider:

    • Enumerating content directly via Microsoft Graph, reading each file’s sensitivityLabel metadata, and optionally calling extractSensitivityLabels to ensure the metadata is up to date.
    • Using Microsoft Purview for compliance‑related scenarios, as it is built on backend compliance pipelines and is the recommended solution for sensitivity and governance reporting.

    Regarding the required region field, As I checked, Microsoft Graph does not currently provide a supported way to query or enumerate all regions. When using application permissions, Microsoft Graph Search API is limited to one geographic region per request, and there is no supported mechanism to perform a single search across all regions.

    I hope this helps.


    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 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2026-02-20T00:10:23.2933333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The Microsoft Graph Search API can be used to discover SharePoint files, but there are some limitations to be aware of:

    1. Reliability for Large Results: The API does not specify a total cap on results, but it is important to note that the search API may have limitations on the number of results returned in a single request. If you expect a large number of results (e.g., larger than 100k), you may need to implement pagination to retrieve all results, as the API will only return a subset of results per request.
    2. Total Result Cap: There is no explicit mention of a total result cap in the context provided. However, the API's behavior regarding large datasets may require careful handling of pagination and result retrieval.
    3. Reliable Way for Large Results: To reliably discover all files with a given sensitivity label, you should consider implementing a loop that continues to query the API until all pages of results have been retrieved. This may involve checking the response for a continuation token or similar mechanism to fetch additional pages of results.
    4. Region Field: The API does require a region field for certain queries. To discover all regions, you may need to query the API for available regions or consult documentation specific to your organization's SharePoint setup to identify the regions that are relevant to your search.

    In summary, while the Microsoft Graph Search API is a powerful tool for discovering SharePoint files, careful consideration of pagination and region handling is necessary for effective use, especially with large datasets.


    References:

    0 comments No comments

Your answer

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