Microsoft graph api Graph Api:搜索精确匹配的文件

Microsoft graph api Graph Api:搜索精确匹配的文件,microsoft-graph-api,microsoft-graph-sdks,microsoft-graph-files,Microsoft Graph Api,Microsoft Graph Sdks,Microsoft Graph Files,我有一个名为“ABC_file1.docx”的文件。 我想搜索特定文件夹中的特定文件名 我的代码是: var fileName = "ABC_file1.docx"; var files = _graphClient .Drives[<My_Drive_ID>] .Root .ItemWithPath("My_Sub_Fo

我有一个名为“ABC_file1.docx”的文件。 我想搜索特定文件夹中的特定文件名

我的代码是:

            var fileName = "ABC_file1.docx";

            var files = _graphClient
              .Drives[<My_Drive_ID>]
              .Root
              .ItemWithPath("My_Sub_Folder")
              .Search(fileName)
              .Request()
              .GetAsync()
              .Result;
var fileName=“ABC_file1.docx”;
var files=\u图形客户端
.驱动器[]
.根
.ItemWithPath(“我的子文件夹”)
.Search(文件名)
.Request()
.GetAsync()
.结果;
不幸的是,这不仅适用于我的文件,也适用于类似的文件名,如“ABC_ABC_file1.docx”,而这不是我需要的


如何搜索精确匹配?

您是否尝试利用文档来搜索可搜索的站点属性,并查看这是否有帮助


谢谢

我刚刚找到了一个解决方案,似乎“搜索”方法不是精确匹配文件搜索所需的方法

最好使用“过滤器”而不是像这样的“搜索”:

            var fileName = "ABC_file1.docx";

            var files = _graphClient
              .Drives[<My_Drive_ID>]
              .Root
              .ItemWithPath("My_Sub_Folder")
              .Children
              .Request()
              .Filter($"name eq '{fileName}'")
              .GetAsync()
              .Result;
var fileName=“ABC_file1.docx”;
var files=\u图形客户端
.驱动器[]
.根
.ItemWithPath(“我的子文件夹”)
儿童
.Request()
.Filter($“name eq'{fileName}'”)
.GetAsync()
.结果;
这不仅解决了搜索精确匹配的问题,还解决了在10/15分钟后在Sharepoint上重命名更新名称的问题(已知问题)