Find Files and Folders query result not clear

I have a Find Files Folders activity which has as query parameter “Test.txt”. On the SharePoint, the following files are present in the searched folder:
As a result I get 2 hits: Test.txt and Copy-Test.txt. I would like to write the query so that exactly only 1 hit = Test.txt is obtained. Can someone help me here? Thank you.

You can use “filename” in your query in the Find Files and Folders
the Microsoft MsGraph API has examples of this.


Yes this is how graph api would work…

It matches all the files containing the procided query parameter…

So what you can do is …the output of find files will have the array of files as well…

So after the file files to identify the correct file use arrayofdrvitems.where(function(x) x.filename.equals("Text"))(0) will give the drive item which has text.txt only

The same can be acheived using combination of for loop and if condition as well

Hope this helps


@Skyman1 do you have an example for use “filename”?


In folder use dictionary you will get all files one by one in loop check the condition with the particular file name with extension, It will work


in your “find files and folders” activity, under the query:
file:“Filename.extension”. This is your driveitem as a single return of the query.

If you are looking for more than one file: “file:”*.xlsx" The returns an array of drivetiems

there is a list of driveitem properties located at driveItem resource type - Microsoft Graph v1.0 | Microsoft Learn

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.