The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Newly created or newly shared documents are not guaranteed to appear immediately in Microsoft Graph Search, so use the document’s driveId and itemId for immediate access when available and treat Search results as eventually consistent.
Microsoft Search queries OneDrive and SharePoint content that Microsoft Search has already indexed; it does not read directly from the document store in real time.^1^ A matching SharePoint case confirms that newly created content can remain absent until SharePoint search indexing completes.^2^
Recommended handling
- Capture the identifiers when creating or uploading the file.
Preserve the returneddriveIdand drive-itemid. - Access the item directly during the post-create workflow:
Direct identifier-based retrieval avoids waiting for the search index. A Microsoft-hosted test of the same general behavior found direct retrieval by site, list, and item identifiers accurate while newly created content was still unavailable through Search.^3^GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id} Authorization: Bearer {token} - If the application does not know the item identifiers, retry the Search request.
Use bounded exponential backoff, for example after 5, 10, 20, 40, and 60 seconds, followed by less-frequent retries. Treat an empty hit set immediately after creation or sharing as potentially transient rather than as proof that the document does not exist.const delays = [5000, 10000, 20000, 40000, 60000]; for (const delay of delays) { const result = await searchGraphForDocument(); if (result.value?.[0]?.hitsContainers?.[0]?.hits?.length) { return result; } await new Promise(resolve => setTimeout(resolve, delay)); } throw new Error("Document is not searchable yet");
There is no documented maximum indexing time for this file scenario in the supplied Microsoft documentation. One Microsoft-hosted test observed approximately five minutes for a new file, but that is an observation rather than an SLA.^3^
Search request considerations
For files, continue using entityTypes: ["driveItem"]; that is the documented request pattern for OneDrive and SharePoint file searches.^4^
POST https://graph.microsoft.com/v1.0/search/query
Content-Type: application/json
{
"requests": [{
"entityTypes": ["driveItem"],
"query": {
"queryString": "filename-or-search-terms"
}
}]
}
Changing the query syntax, repeatedly submitting the same request, or manually searching in SharePoint cannot guarantee immediate indexing. Search should therefore not be the consistency check for a create-and-share transaction.
Also note that Search is not necessarily a one-for-one semantic replacement for /sharedWithMe: Search returns indexed content matching the query and trims results according to the searching user’s access. The deprecated /sharedWithMe method specifically returns items shared with the drive owner and will operate in a degraded state until November 2026, after which it stops returning data.^5^
When to escalate
Open a Microsoft 365 support request through an administrator if:
- previously searchable documents disappear;
- delays become consistently much longer than the tenant’s normal indexing latency;
- established documents are missing for only some users despite those users having access; or
- Search returns server errors rather than successful responses with zero hits.
Provide the UTC creation/share time, tenant region, request ID, timestamp, sanitized request body, affected site/drive, and the time at which the document eventually became searchable.
References