MarketplaceStudioSnippetFolder Level Utilities

Create your first automation in just a few minutes.Try Studio Web

Folder Level Utilities

Folder Level Utilities

by Kai Boon

StarStarStarStarStarStarStarStarStarStar

0

Snippet

Downloads

<100

back button
back button
carouselImage0
next button
next button

Summary

Summary

These snippets are used to simplify file and folder level workflows and can be reused multiple times in a complex process.

Overview

Overview

Across many sectors, it is very common to have use cases involving the use of File Explorer or SharePoint for :

  1. Storing/archiving of files.
  2. Downloading of attachments from browser or applications.
  3. Working across multiple user profiles and machines via file sharing services.

These use cases often require many pre/post-requisite steps to ensure that the environment is bot-friendly. Due to the repetitive nature of these steps, we have created utilities/libraries for this purpose and have saved many hours of development as well as ensure quality and consistency across all our processes.

Some examples of these utilities are :

  1. Checking if certain file or folder paths are rooted, and if not, to append a user profile root to the file path (useful for cases where file and folder paths provided by users may or may not be rooted and if working across multiple user profiles, etc.).
  2. Validating if the default downloads folder is empty, and if not, archive the items within into a date-time stamped folder (useful for situations where downloading of attachments from browser or applications does not have the option of specifying folder or file paths).
  3. Uploading files to SharePoint - utility works for either file or folder uploads and if upload has failed, files/folders are copied to a predefined local destination to avoid data loss + custom error message to inform user on the error (useful for any process that requires work with SharePoint).

This release contains 5 snippets:

  1. Util_CheckFolderStructureIsRoot - This workflow is used to check if configuration file paths are full paths and skip, else add local user profile to the relative paths to complete the configuration values.
  2. Util_CheckLocalRootDirectory - This workflow is used to check if a given folder structure exists on the user's machine. If not (i.e. on first run), bot will copy a mock directory from the source code stored in "Data\Local Root Directory\Data" into the desired location on the user's machine.
  3. Util_ClearDownloadsFolder - This workflow checks if there are files in the default downloads folder and proceeds to delete them. This is used in tandem after Util_ValidateDownloadsFolder, and in a Process Try Catch to reset the environment for the retry.
  4. Util_UploadFilesToSharePoint - This workflow uses the CopyDirectory method to move files from inSourceFolderPath (usually "Data/Temp") and copies the directory into inTargetFolderPath (usually the bot output path).
  5. Util_ValidateDownloadsFolder - This workflow checks if the default downloads folder has no files, else creates an archive folder within to move the files into that folder to avoid file name conflicts in future workflows.

Features

Features

These workflows can be used as standalone bots or within more complex processes as long as the arguments required are provided (e.g. file/folder paths, default download path, etc.). Robust error handling is baked into these workflows to ensure that the utilities are watertight. This use case is useful for beginners and even intermediates to understand the importance of code reusability and consistency, and how to achieve them in long running workflows.

Additional Information

Additional Information

Dependencies

UiPath.System.Activites 23.4.3

Code Language

Visual Basic

Publisher

Kai Boon

Visit publisher's page

License & Privacy

MIT

Privacy Terms

Technical

Version

1.0.0

Updated

August 17, 2023

Works with

Studio: 23.4.2+

Certification

Silver Certified

Application

Microsoft SharePoint

Support

UiPath Community Support

Resources