For Each File or Folder

Estimated reading: 5 minutes

The For Each File and Folder activity retrieves files and folders from a configured SharePoint location based on the specified search criteria. It allows you to filter, sort, remove duplicates, and limit the number of items retrieved.

The activity executes the configured Do section for each retrieved file or folder. The current item is available through the Item Name variable, which can be used within the Do section to process the item. The activity also provides outputs indicating the number of items processed and the execution status.

Prerequisites

1. A Microsoft SharePoint account with access to the required SharePoint site, files, and folders is required.
2. A SharePoint connection must be configured and authenticated in Robility Manager’s App Integration.
3. The connected account must have permission to access the selected SharePoint files and folders.
4. The project must be added in the Publish option to access the configured SharePoint connection.

Configure SharePoint Connection

Before using the For Each File and Folder activity, create and authenticate a SharePoint connection in Robility Manager’s App Integration.

Once the connection is successfully created and authenticated:

1. Open Robility Designer.
2. Add the For Each File and Folder activity to the workflow.
3. Select the configured account from the SharePoint dropdown.
4. Select the SharePoint location to search.
5. Configure the search criteria and retrieval options.
6. Add the required activities inside the Do section.

The activity uses the selected SharePoint connection to authenticate and access SharePoint resources.

Authentication

The SharePoint integration uses Microsoft SharePoint authentication. During connection setup, sign in with your Microsoft SharePoint account and grant the required permissions. Once authenticated, the connection becomes available for selection in SharePoint activities within Robility Designer.

Limitations

1. Only files and folders accessible to the authenticated Microsoft SharePoint account can be retrieved.
2. Search results depend on the account’s SharePoint permissions and visibility settings.
3. The maximum number of retrieved items is controlled by the Limit to First property and applicable SharePoint service limitations.
4. Retrieval performance may vary depending on the number of items, search criteria, and SharePoint response time.

Activity Details in Canvas

SharePoint*: Select the account from the available connections. The selected account is used to authenticate and access SharePoint.

FileOrFolder: Specifies the SharePoint file or folder location to search. Enter the path directly or select it using the available input options.

Item Name: Specifies the variable that stores the current file or folder being processed. Use this variable inside the Do section to access the current item.

Search Type: Specifies the method used to retrieve files and folders from the selected SharePoint location.
Simple Search: Retrieves files and folders based on a keyword or text value specified in the Search Text field.
Advanced Search: Retrieves files and folders using filter conditions. Use the Filter Builder to define criteria based on file and folder properties.

Search Text: Specifies the keyword or text used to search for matching files and folders. This field is available only when Simple Search is selected. Direct values or variables can be used.

Do: Contains the activities to execute for each retrieved file or folder. The activities in this section run once for each matching item.

Note: Values configured on the canvas are automatically reflected in the corresponding properties and can also be modified from the Properties panel.

Properties

INPUT

Limit to First: Specifies the maximum number of files and folders to retrieve from the selected SharePoint location. Supports integer values and integer variables.

The default value is 200. The activity retrieves up to the configured number of matching items, subject to SharePoint service limitations.

Sort By: Specifies the sort direction for the retrieved files and folders.
Ascending: Sorts the results in ascending order.
Descending: Sorts the results in descending order.

Trim Duplicates: Specifies whether duplicate items should be removed from the search results.
Yes: Removes duplicate items from the retrieved results.
No: Retains duplicate items returned by the search operation. This is the default value.

What to Return: Specifies the types of items to retrieve from the selected SharePoint location.
FilesAndFolders: Retrieves both files and folders that match the search criteria.
Files: Retrieves only matching files.
Folders: Retrieves only matching folders.

MISC

DisplayName: Specifies the display name of the activity. Customize it to identify the activity in the workflow.

SkipOnError: Specifies whether workflow execution continues when the activity encounters an error.
True: Continues workflow execution even if an error occurs.
False: Stops workflow execution when an error occurs.
None: Uses the default value, False.

Version: Displays the current version of the activity.

Output

NumberOfFileOrFoldersProcessed: Returns the total number of files and folders processed by the activity.

Result: Returns a Boolean value indicating the execution status of the activity.
True: The activity executed successfully.
False: The activity failed due to an unexpected error.

Example

Suppose a SharePoint document library contains multiple files and folders, and you want to retrieve up to 10 matching items, remove duplicates, sort the results in ascending order, and process each item.

Configure the Activity

To retrieve and process the matching files and folders, configure the activity as follows:

1. SharePoint: Select the configured SharePoint account that has access to the required document library.
2. FileOrFolder: Specify the SharePoint location to search.
3. Item Name: Use the default variable or specify a suitable variable name to store the current item.
4. Search Type: Select Simple Search.
5. Search Text: Enter the text to search for.
6. Limit to First: Enter 10 to retrieve a maximum of 10 matching items.
7. Sort By: Select Ascending to sort the results in ascending order.
8. Trim Duplicates: Select Yes to remove duplicate items from the results.
9. What to Return: Select FilesAndFolders to retrieve both files and folders.
Add the required processing activities inside the Do section to process each retrieved item.

Result

After execution, the activity retrieves the matching files and folders and executes the activities in the Do section for each retrieved item. The NumberOfFileOrFoldersProcessed output returns the number of items processed, and the Result output returns True when the activity completes successfully.

Share this Doc

For Each File or Folder

Or copy link

CONTENTS
Robility Chatbot
Robility Assistant
Online