If you have the full filename and need an exact match why not just do a filter on name? Like GET /me/drive/root/children?$filter=name eq 'ABC_file1.docx'.
The essence of a search is to match the text against the name of the file and return anything that matches to some degree of accuracy and ABC_ABC_file1 query against ABC_file1 will matches the last 10 characters of the query
Search file for exact match
Maximiliano Bertoli
26
Reputation points
I have a file called "ABC_file1.docx".
Performing this search I can find my file:
var fileName = "ABC_file1.docx";
var files = _graphClient
.Drives[<My_Drive_ID>]
.Root
.ItemWithPath("My_Sub_Folder")
.Search(fileName)
.Request()
.GetAsync()
.Result;
This also works if I search a file called "ABC_ABC_file1.docx", but this is an issue for me.
How can I search for exact match?
Microsoft Security | Microsoft Graph
13,724 questions
Accepted answer
-
Danstan Onyango 3,906 Reputation points Microsoft Employee
2021-05-12T17:48:49.56+00:00