Share via

The endpoint GET /me/drive/root/search(q='.xlsx') does not return new files, while GET /me/drive/recent and direct access by path work correctly.

Andrey Naymovets 0 Reputation points
2026-03-26T13:30:54.87+00:00

I use this endoint to get all files in excel
https://graph.microsoft.com/v1.0/me/drive/root/search(q='.xlsx%20OR%20.xls%20OR%20.xlsm')?%24select=id%2Cname

I don't receive all the files in response:
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.driveItem)","value":[{"id":"CB9038DC6C0869!1896","name":"test-case2.xlsx"},{"id":"CB9038DC6C0869!1898","name":"test-case.xlsx"},{"id":"CB9038DC6C0869!1899","name":"Test-case(example).xlsx"},{"id":"CB9038DC6C0869!4850","name":"test-case(статьи).xlsx"},{"id":"CB9038DC6C0869!4851","name":"test-case(кнопки).xlsx"}]}

For the test, I used a different endpoint. It returned file that weren't in the previous request.
https://graph.microsoft.com/v1.0/me/drive/items/00CB9038DC6C0869!s405c1438757a49c3b13d21fa33cfbb64

In response:

{

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('lll-96%40mail.ru')/drive/items/$entity",

"@microsoft.graph.downloadUrl": "https://my.microsoftpersonalcontent.com/personal/00cb9038dc6c0869/_layouts/15/download.aspx?UniqueId=405c1438-757a-49c3-b13d-21fa33cfbb64&Translate=false&tempauth=v1e.eyJzaXRlaWQiOiIyZGZiYTIyNS1mMDM2LTRiMTYtYTkzZi0wMDUwMTFlZGJjNDAiLCJhcHBfZGlzcGxheW5hbWUiOiJBbGJhdG8iLCJhcHBpZCI6IjdjZDgxMDhlLTBjNGUtNDk5OC04MmFjLWRlNzM5NTYwZjFlMiIsImF1ZCI6IjAwMDAwMDAzLTAwMDAtMGZmMS1jZTAwLTAwMDAwMDAwMDAwMC9teS5taWNyb3NvZnRwZXJzb25hbGNvbnRlbnQuY29tQDkxODgwNDBkLTZjNjctNGM1Yi1iMTEyLTM2YTMwNGI2NmRhZCIsImV4cCI6IjE3NzQ1MzUyMTcifQ.-TTC37ps-wrYfU2pFELz6vRwnG9vRvQzRl2VMyMu3gLeWsJR2PLBB30Ouu97cZXcmHUqnBBHIjJkiWFRk8ObSaj0_SvH1caUbx71u-7iDssJu4JB2Z_Ilo3PRf2_I214UPmRUe8xdQulAUQvSRsZqWT6uBN-c_-qXEbJZzO5XQdxkOZIyde82JyNKK1Hy378gWZci6oiO5ccQ0itoIbmcZCrFhx3aciLMJ2a2SNXOnACIWA0fqoSHD7WNL4gPQyAf2GyMLHYW6IaBAhxuVnU6HYvvjfzv1mbn5N8Bz6oNE6clAoH2GiLQpJzjlrzmAKjQOYc6-ng1B6l8mD-IkjUx_Zqt5-OSD7t_-bFNqDTDOk_OpgVGNrrqEX5Q1ZLmrx2h_B2Bsc946PVsfNLy-ZEdD7PRksBlYos5q-KsJNxfjAUClIiBwOu1RdDMxcYVcqj-KIMSdBiCdibPphwDoYKsHgGYfJw03Qo86DQcR3qNzo.uU6XnvGLPuvpTXLOPoMbQDGzocH2Ss6-MF62nM6A7rU&ApiVersion=2.0",

"createdDateTime": "2026-03-26T11:36:31Z",

"eTag": "\"{405C1438-757A-49C3-B13D-21FA33CFBB64},8\"",

"id": "CB9038DC6C0869!s405c1438757a49c3b13d21fa33cfbb64",

"lastModifiedDateTime": "2026-03-26T12:54:36Z",

"name": "Book.xlsx",

"webUrl": "https://onedrive.live.com/personal/00cb9038dc6c0869/_layouts/15/doc.aspx?resid=405c1438-757a-49c3-b13d-21fa33cfbb64&cid=00cb9038dc6c0869",

"cTag": "\"c:{405C1438-757A-49C3-B13D-21FA33CFBB64},8\"",

"size": 6828,

"createdBy": {

"application": {

"id": "2821b473-fe24-4c86-ba16-62834d6e80c3",

"displayName": "i:0i.t|ms.sp.ext|2821b473-fe24-4c86-ba16-62834d6e80c3@9188040d-6c67-4c5b-b112-36a304b66dad"

},

"user": {

"email": "******@mail.ru",

"id": "00CB9038DC6C0869",

"displayName": "Андрей Наумовец"

}

},

"lastModifiedBy": {

"user": {

"email": "******@mail.ru",

"id": "00CB9038DC6C0869",

"displayName": "Андрей Наумовец"

}

},

"parentReference": {

"driveType": "personal",

"driveId": "00CB9038DC6C0869",

"id": "CB9038DC6C0869!sea8cc6beffdb43d7976fbc7da445c639",

"name": "Documents",

"path": "/drive/root:",

"siteId": "2dfba225-f036-4b16-a93f-005011edbc40"

},

"file": {

"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",

"hashes": {

"quickXorHash": "xzkpymHYJ6Qzf3G+AYiFfaeioLM=",

"sha1Hash": "FDFB4D6E0DBACA487C701965711658229563300D",

"sha256Hash": "584A81236F076F24ABBB57CC693FC3A1EB4C250D1BFE4520D376C48BAB85744C"

}

},

"fileSystemInfo": {

"createdDateTime": "2026-03-26T11:36:31Z",

"lastModifiedDateTime": "2026-03-26T12:54:36Z"

}

}

Microsoft 365 and Office | OneDrive | For home | Windows
0 comments No comments

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-03-26T13:31:14.47+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The behavior is due to how the OneDrive/Graph search API works and its limitations, not to a problem with the file itself.

    Key points from the documented behavior:

    1. search(q=...) is not a full, immediate index of all items
      • GET /me/drive/root/search(q='{search-text}') searches items using an index that can lag behind recent changes. Newly created or recently modified files may not appear until the index is updated.
      • The query text is matched across several fields (filename, metadata, and file content), but only against what has been indexed so far.
    2. Search scope and paging
      • GET /me/drive/root/search(q='{search-text}') searches under the root item of the drive hierarchy.
      • If there are many matches, results are paged and an @odata.nextLink is returned. Only the first page is returned initially; additional pages must be requested explicitly. If the result set is large and paging is not followed, some matching items will not be seen.
    3. Differences and limitations in OneDrive search
      • The OneDrive/SharePoint release notes call out that item searching has specific limitations and differences from other operations. For OneDrive for Business and SharePoint, search does not return some properties (createdBy, modifiedBy, parentReference), and there are other behavioral differences compared to direct item access.
      • While the notes focus on business/SharePoint, they highlight that search behavior is not identical to direct addressing (/items/{item-id}) and can omit or delay items.
    4. Why GET /me/drive/recent and direct path access work
      • GET /me/drive/recent returns items recently used by the signed-in user and is based on recent activity, not the same index used by search. It can therefore show items that are not yet visible in search.
      • Direct access by ID or path (/me/drive/items/{item-id} or /me/drive/root:/path/to/file) does not depend on the search index; it reads the item directly from the drive and will always find an existing file.

    Practical implications for this scenario:

    • A newly created Excel file like Book.xlsx can be:
      • Accessible directly by /me/drive/items/{id} or by path.
      • Visible in /me/drive/recent.
      • Temporarily missing from /me/drive/root/search(q='.xlsx OR .xls OR .xlsm') until the search index updates.
    • If many Excel files exist, ensure that:
      • All pages of search results are followed via @odata.nextLink.
      • $top is used appropriately if a specific page size is needed.

    If all pages are being followed and the file still does not appear after some time, the recommended approach is to rely on:

    • Direct addressing by path or ID for critical operations, and
    • search only as a best-effort discovery mechanism, understanding that it may not be complete or real-time.

    References:

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.