activities
latest
false
Productivity Activities
Last updated Oct 23, 2024

For Each File/Folder

UiPath.MicrosoftOffice365.Activities.Files.ForEachFileFolder

Description

Uses the Microsoft Graph Microsoft Search API (for Advanced Search) or Microsoft Graph Search items API (for Simple search) to perform an activity or a series of activities on each file/folder that matches the filter criteria.

For more details about the Microsoft Search API implementation, please check the following resources:

Note: This activity doesn't support persistence.

Project compatibility

Windows - Legacy | Windows

Configuration

In the Body of the Activity
  • For each -  Enter the name by which to refer to the current file in the iteration. Using a name that describes the type of file in the folder makes it easier to identify and select the current file option when configuring activities added inside For Each File/Folder. For example, for a folder that contains reports, you can enter Report. The default value is DriveItem.
Properties Panel

Common

  • DisplayName - The display name of the activity in the Designer panel. This property supports String variables and string formatted values.

Input

  • Advanced search - The Keyword Query Language (KQL) query for the files and folders to be retrieved.

    Note:

    The activity uses the documentLink property restriction with a URL built from the location specified in Files Repository and the value in the Folder parameter. Do not use the "documentLink:" or "path:" properties restriction in the AdvancedSearch parameter.

  • Simple Search - The query text used to search for files and folders across several fields like filename and file content. This property supports String variables and string formatted values.
  • Use Simple Search - When active, the simple search is used instead of the advanced search. If this option is active, then the Include Subfolders parameter is ignored. This field supports Boolean values.

    Note:

    If Use simple search is selected, the Files Repository property only supports the OneDrive, SharePoint, and Specific Url options.

    The activity can now be used with personal Microsoft accounts and with ApplicationIdAndSecret and ApplicationIdAndCertificate authentication types (when used inside Microsoft Office 365 Scope activity) if the Use simple search option is checked.

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level. This field supports Boolean values.

Options

  • Account - The ID or User Principal Name for the user who owns the OneDrive. This parameter must be set for ApplicationIdAndSecret and ApplicationIdAndCertificate authentication types. This property supports String variables and string formatted values.
  • Folder - The path to a folder, within the specified files repository, in which to search (e.g. SomeFolder or SomeFolder/AnotherFolder). If left blank, the root folder is searched. Not taken into consideration when Files Repository is set to All. This property supports String variables and string formatted values.
  • Include Subfolders - Specifies whether to expand the search to include all subfolders of the selected cloud location. This field supports Boolean values.
  • Limit To First - The maximum number of files and folders to return. If left blank, it retrieves all files and folders matching the filter criteria. This field supports only integer and Int32 variables. The default value is 200.
  • Trim Duplicates - Specifies whether duplicate file/folder items should be removed from the search results. This field only supports Boolean values (True, False). The default value is False.
  • What To Return - Select whether to return only files, only folders or both:

    • Files and Folders
    • Files
    • Folders

Output

  • Index - A zero-based index that specifies which element of the current collection is being iterated. This field supports only integer and Int32 variables.

Repository

  • Files Repository - The files repository where to search for files and folder. Select one of four options: All, OneDrive, SharePoint, SpecificUrl. The default value is All.
  • SharePoint Document Library - The document library within the specified SharePoint site. This property supports String variables and string formatted values.
  • SharePoint Site Url - The URL of a SharePoint site to search in. This property supports String variables and string formatted values.
  • Specific Url - The URL of a specific location to search in. This property supports String variables and string formatted values.
    Note: Sometimes Microsoft Search API returns duplicate file or folder items. By selecting the option Trim Duplicates, the activity removes duplicates from the search results.

Filtering Examples

The following table shows examples of filters that can be useful when you query files or folders:

Query

Filter Expression

All Excel files in the specified location

"fileextension:xlsx"

All text and portable document format files in the specified location

"fileextension:txt OR fileextension:pdf"

All files with the name "Agenda Brief.xlsx"

"filename:""Agenda Brief.xlsx"""

All Excel files with the word "users" in the file name

"fileextension:xlsx AND filename:users"

All Excel files modified on 06/14/2021 with the word "users" in the file name

"fileextension:xlsx AND filename:users AND lastmodifiedtime=06/14/2021"

All Excel files modified before 06/14/2021 with the word "users" in the file name

"fileextension:xlsx AND filename:users AND lastmodifiedtime<06/14/2021"

All files and folders created by "John Smith" before 06/12/2021

"createdby:""John Smith"" AND created<06/12/2021"

All files that have been explicitly shared with "Cory Belcher"

"sharedwithusersowsuser:""Cory Belcher"""

  • Description
  • Project compatibility
  • Configuration
  • Filtering Examples

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.