'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.

3 Likes

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 Docs) 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 in Microsoft Graph to search files - Microsoft Graph | Microsoft Docs

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.

1 Like

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!