You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Microsoft Graph API:/me/drive/root/search无法筛选特定扩展名文件咨询

The core issue here is that you’re using the wrong search operator for file extensions in the Graph API’s q parameter. Unlike some other search tools that use filetype:, Microsoft Graph’s search syntax relies on ext: to target specific file extensions—and that’s why your original query returned no results.

Correct Query Syntax

Swap out filetype: for ext: in your query string, and you’ll get the filtered results you’re expecting:

https://graph.microsoft.com/v1.0/me/drive/root/search(q='book ext:xlsx OR ext:xls OR ext:svg OR ext:json OR ext:txt')

Why This Works

Microsoft Graph’s built-in search query language uses ext: as the dedicated operator for filtering by file extension. The filetype: keyword isn’t recognized by this endpoint, so your original query was effectively asking for files that matched "book" but had no valid extension filter applied.

Quick Notes

  • Double-check your app has the necessary permissions (like Files.Read or Files.Read.All) to access the files you’re searching for—though it sounds like your permissions are already set correctly since you can retrieve results and filter them manually.
  • The /search endpoint doesn’t support combining the q parameter with $filter, so using the ext: operator is the proper server-side way to narrow down results by file type, avoiding the need for post-response manual filtering.

内容的提问来源于stack exchange,提问作者Paweł Wojtaszko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:34:24