'Find Files And Folders' activity in Office365 Scope, how to get file in a folder

Hey Forum.

I’ve sat up Office365 in Azure portal and everything works. However I’m a little unsure about the query in ‘Find Files And Folder’.

I got two folder A and B with the same two files in each, File1 and File2

How will I query to get e.g. the File2 in A?

I can query for e.g. File1 or folder A, but I need the specific query.

Hey Laura,
I’m stuck in a similar situation. Did you get answer for that??

Same here. I had to use SharePointAcitivites. But for more complex use case I might need O365 and find all children …

This is now fixed in v1.3.0 of UiPath.Office365.Activites. A SubFolder field has been added to let you specify which folder to search in.


Same think here : what is the syntax used into query ? Is there any documentation about it ? e.g. how do I search only files created by a specific user ?


Hi Emaanuel,

have you got any answers regarding syntax of search query ? looking for same, unable to find anything meaningful

@DeanMauro , from which source i would be able to get updated package, Please help

Hi guys,

I’ve stopped working on these activities, but @ovidiuponoran can you help?

1 Like

Sure @DeanMauro

Unfortunately, the Microsoft Graph REST API we are using in the implementation of Find Files and Folders activity (Search for files - Microsoft Graph v1.0 | Microsoft Learn) is very limited in version 1.0.

There is a Beta version of this API that offers enhanced filtering capabilities, but we cannot use it because APIs under /beta version in Microsoft Graph are subject to change.
With this version it is possible to define filters like the ones shown here Use the Microsoft Search API to search OneDrive and SharePoint content - Microsoft Graph | Microsoft Learn

In the current implementation of Find Files and Folders activity you can specify only basic filter expressions like:

  1. Get all files and folders directly under root folder: provide no value for Subfolder and Query parameters.

  2. Get all files and folders directly under a folder: Subfolder = “MyFolder” & Query = (no value).

  3. Get all files and folders containing text “file” (it searches in folders names, files names, files content): Query = “file”

  4. Get all files and folders containing text “file” or “test” (it searches in folders names, files names, files content): Query = “file OR test”

That’s pretty much all you can do right now.


Hi! I would like to receive some suggestions .
I am using Offcie365 - v 1.6. . I am trying to get Files/Folders List from Sharepoint and Check if a Folder exists… If the Folder is empty (without files), my return is error (no item)… If the Folder is not empty, my return is the Drive/File.
What I need to do to receive FOLDER information (from this empty Folder) instead Error ?

Hi @vicenteNeto

  1. Find Files and Folders: set the output parameter Results = searchResults (variable of type Microsoft.Graph.DriveItem[ ])
  2. Add a For Each activity with TypeArgument = Microsoft.Graph.DriveItem and Values = searchResults
    2.1. For each item, add an If activity with Condition = not item.Folder is nothing (this means the drive item is a Folder). If the condition is true, item.folder.ChildCount will give you the number of children in that folder (if 0, it means empty folder).


Thks. Dear.

I must get files not at the last one Directory . I must get the Directories and Files at the Middle of the Path (e.g Drive=Documents; Subfolder = “manager/files” - it´s Ok ; Drive=Documents; Subfolder = “manager” - not folder and files in Results.

The last one directory Ok to get Files and Folders but Directory at the middle (Gerenciamento de Internados) no files and folders - error message

For me , not using last Folders (Auditoria Externa), uipath shows :

RemoteException wrapping Microsoft.Graph.ServiceException: Code: itemNotFound
Message: The resource could not be found.

The problem was Access to the Folder!

@ovidiuponoran Thanks for this post. The information about the Query parameter is the only information about how it works that I’ve been able to find.

In my tests, Query seemed to only work as a “‘filename’ or ‘foldername’ contains” filter. I tested with several file types (.xlsx, .docx, .txt) and never could get it to work by “content” (i.e. text found within the file). I also tried setting file attributes in Sharepoint to certain text, but Find Files and Folders did not find them. What did you mean by the word “content” in #3 and #4 in your post?

Also, I was not able to get the OR syntax to work (#4). Do you have any more details about how “OR” works?


finds 0 files.

But changing the queryString to “Chiefs” returns the expected two files (ChiefsWin.xlsx and Chiefs.docx). (But as mentioned in the “contents” question, it does not find sometext.txt which contains the word “Chiefs” within the file.

Hello!! I solved the problem!!

You have to write the extact name of the file or folders you wanna find. For exemple, if you want to find the excel named “Invoice_Tech” you have to put in the query “Invoice_Tech.xlsx” and the bot will search all your entire files in your computer until he finds the exact file.

You can write partial string like .pdf or .xlsx. ALso note that the query is case sensitive.