top of page

Effortlessly Get Files from SharePoint for Your UiPath Robot: Two Simple Methods

If you're using UiPath to automate tasks that involve SharePoint, you'll likely need to retrieve files from SharePoint at some point. While there are many ways to access SharePoint files, some methods are more efficient than others. In this blog post, we'll explore two simple methods for getting files from SharePoint to your local machine to make them available for your UiPath robot to update.


Method 1: Syncing SharePoint with OneDrive

One of the easiest ways to get files from SharePoint to your local machine is by syncing SharePoint with OneDrive. OneDrive allows you to sync files and folders from SharePoint document libraries to your local computer, making them available offline and allowing you to work on them without an internet connection.


Here are the steps to sync SharePoint with OneDrive:

  1. Navigate to the SharePoint document library you want to sync.

  2. Click the Sync button in the toolbar.

  3. Follow the prompts to choose where to sync the library on your computer.

This process typically takes 5-10 minutes, depending on the size of the library and the speed of your internet connection. Once the sync is complete, you'll be able to interact with the files in your local folder just like any other file on your computer.


Advantages and Disadvantages:

While this method is easy to set up and use, it may be slower to sync large libraries or if you have a slow internet connection. It may also require additional OneDrive or SharePoint licenses, and may not work if you have restricted access to SharePoint or OneDrive. Finally, it requires ongoing management to ensure syncs are up to date and complete.


Interacting with files in UiPath:

UiPath can interact with files that have been synced to a local folder just like any other file on your computer. Use the standard UiPath activities for file manipulation, such as "Read Text File" or "Write Text File", to interact with the files in your synced folder.


Method 2: Using SharePoint's REST API

Another way to get files from SharePoint is by using SharePoint's REST API. The REST API allows you to interact with SharePoint document libraries using HTTP requests, including retrieving files from document libraries.


Here's a basic overview of how the REST API works:

The REST API uses URLs to access SharePoint resources, such as lists and document libraries. HTTP requests can be used to interact with these resources, including retrieving files from document libraries.


Here are the steps to use the REST API to retrieve files:

  1. Identify the SharePoint site, document library, and file you want to retrieve.

  2. Construct a URL that includes the necessary information to retrieve the file.

  3. Use an HTTP GET request to retrieve the file.

This process typically takes 30-60 minutes, depending on the complexity of the API call and the developer's expertise with REST APIs and programming languages such as Python or PowerShell.


Advantages and Disadvantages:

While this method offers more flexibility in accessing SharePoint resources, it requires technical expertise to use effectively. It may also require additional security measures to ensure safe use, and keeping track of client ID and client secrets is yet another credential to manage. Finally, it requires complex code that will require ongoing maintenance when Curl version is updated or client secrets are changed.


Interacting with files in UiPath:

To interact with files retrieved using the SharePoint REST API in UiPath, use the standard UiPath activities for HTTP requests, such as "HTTP Request".


Conclusion:

Both of these methods offer simple and efficient ways to get files from SharePoint for your UiPath robot to update. While syncing SharePoint with OneDrive is easy to set up and use, using the SharePoint REST API may allow for more flexibility in accessing SharePoint resources if you don't have OneDrive. However, in almost every situation, my preference would be to use method 1 as it is simple, straight to the point, and doesn't require any unnecessary coding.


We are in the business of streamlining and automating business processes, so why complicate things?


This method allows for easy and quick access to SharePoint files, and makes them available offline for use by UiPath robots. Additionally, in my experience, method 1 has resulted in zero issue rather than multiple API errors along the way.

107 views1 comment

1 Comment

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Guest
Dec 15, 2023
Rated 5 out of 5 stars.

Great article! I always choose sync because in my company the SharePoint API always has errors.

Like
bottom of page