Get Folder Contents
The Get Folder Contents flow action outputs all the files and folders within a queried external storage folder as a collection of resources. The output collection can then be used in flow elements further.
The image below gives an overview of the input parameters. Detailed description of these parameters are provided in the following section.
The Get Folder Contents flow action can be combined with various other flow actions or elements to automate processes. For example, you can perform a simple null check on the output collection to determine if the queried folder is empty, or apply more complex logic, such as looping through the collection to segregate files based on naming conventions.
The flow snippet below demonstrates a use case where the Get Folder Contents action retrieves the contents of a template folder with a predefined sub-folder structure. The output collection is then looped over to replicate this structure into another folder, creating each sub-folder one by one with the same name as the current folder in the loop.
This action requires the metadata of the target folder to retrieve its contents.
The image below shows the mandatory fields populated for reference.
Each parameter is explained in detail below.
The Library parameter is the external storage type you are using. Possible values are sharepoint, google (for Google Drive), onedrive, dropbox, box, cloudfiles (AWS S3).
This is a mandatory input parameter.
This is important for Google Drive & Sharepoint libraries only. The Drive ID is a unique identifier for a storage location in both SharePoint and Google Drive. In SharePoint, it represents a document library within a site, while in Google Drive, it identifies a user's drive or shared drive.
This is a mandatory input parameter.
This is the folder Id of the target folder whose contents are to be retrieved.
This is a mandatory input parameter.
You can get these three parameters by viewing metadata details for a folder in the “Content Library” tab of CloudFiles app in Salesforce or can be fetched through other flow actions like Get Connected Folder.
This parameter is not in use currently and can be toggled off.
This parameter is not in use currently and can be toggled off.
This parameter is not in use currently and and can be toggled off.
The action returns all the contents of the input folder as a collection of resources.
In the GIF below, it is shown how the flow action retrieves the contents from a folder.