Hi Davis Nguyen,
Have a good day and welcome to Microsoft Q&A Forum!
Thank you very much for bringing this to our attention and for sharing your observations in such detail. I completely understand how confusing it can be to see two different values for lastModifiedDateTime depending on which API is used. I appreciate your patience as we work through this together.
Based on my research, this difference appears to be expected behavior related to how Microsoft Graph Search works under the hood.
When using the Microsoft Graph Search API (/search/query), the data returned comes from a search index not directly from the live source (such as SharePoint or OneDrive). This index takes time to update after changes are made to the underlying items. So if an item was recently modified, the Search API might still return the previous lastModifiedDateTime, since the new value hasn’t yet been indexed.
On the other hand, when calling the ListItem API (/sites/{siteId}/lists/{listId}/items/{itemId}), you're accessing real-time data straight from the SharePoint list. As a result, this API reflects the latest modification immediately.
Microsoft documentation seems to support this explanation. One relevant article is: Search doesn't return expected results in SharePoint
In particular, it notes:
“This issue might occur if the new or updated items in SharePoint Online or OneDrive have not yet been crawled and indexed.”
While this article focuses on missing items from search, my understanding is that a similar delay may apply to metadata updates reflected in the search index hence the mismatch you're seeing.
Here are a few suggestions that may help depending on your scenario:
1. Wait for the indexing to catch up: My understanding is that the search index updates automatically, but it may take several minutes (in some cases longer) for recent changes to be included.
2. Manually trigger reindexing: If you need faster results, you can manually reindex a SharePoint list or library. Microsoft's official guide for this is here: How to reindex a document library or list
3. Use live-data APIs for time-sensitive operations: If having the latest lastModifiedDateTime is critical for your use case, I suggest relying on the ListItem or DriveItem API, which return up-to-date values in real time.
In short, this mismatch is not a bug, but an expected behavior due to the nature of how Microsoft Search infrastructure works. The Search API uses asynchronous indexing, which introduces some delay by design.
From what I’ve found, this behavior aligns with how Microsoft Search is designed to work, but I certainly understand that it can present challenges depending on your use case. And I truly appreciate your careful attention to this issue.
Wherever possible, I’d recommend using option 3 the direct data APIs especially in cases where accuracy and timeliness of metadata are critical. This tends to offer the most reliable and predictable results without relying on the timing of the search index.
Please don’t hesitate to let me know if you’d like any help reviewing your current implementation or exploring alternatives. I’d be happy to support further.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.