How to use Query parameter of Office365 Find Files And Folders

I’ve seen this question posted before and to my knowledge it has not been answered.

How is the Query parameter of Office365 Find Files And Folders used? The only examples I have seen involve simplistic filtering on a single static text value. How do you use it to search for something like "all the files and folders that contain the text “messages_1”? The documentation says to see driveItem resource type - Microsoft Graph v1.0 | Microsoft Learn which describes the Microsoft driveItem object. Following the links on that page, I have tried various odata queries like

$filter=startsWith(name,‘messages_1’)

to no avail.

Can someone who has figured this out please post here to describe the syntax that Find Files And Folders is expecting in that Query parameter?

1 Like

Hey @Bill_Richardson

Could you please try the below options please…

displayName:<YourFileName>
name:<YourFileName>

Thanks
#nK

Thanks for the reply, @Nithinkrishna .

I tried both the displayname: and name: options you suggested. Neither finds any files.

Through further experimentation, I’ve come to the conclusion that the Query parameter is a “file/folder name contains” filter, and that that there seem to be no other syntax options for “and” or “or”, etc. Another post I found mentions that it searches file contents and that “and/or” syntax is possible, but I did not find that to be the case in my tests. I replied to that post here: 'Find Files And Folders' activity in Office365 Scope, how to get file in a folder - #13 by Bill_Richardson

1 Like

Activity “Find Files and Folders” relies on the API provided for search through driveItems, which can return incomplete results sometimes.

As an alternative, would “For each file/folder” work for your automation?