Upload File To A Document Library In SharePoint

How to upload a file to a Parent and Sub Library in SharePoint?

Below instructions demonstrates how to upload two files to the Documents library of one's SharePoint site (i.e. https://yourSharePointWebsite.com/sites/Site-Name):

Prerequisites:

  • Create sample files File1.txt and File2.txt
  • Create a sub-folder within Documents Library named "Test"

Steps:

  • File1.txt will be uploaded in the root folder of the Documents library.
  • File2.txt will be uploaded in the "Test" sub-folder of the Documents library.

Before running the workflow, the content of Documents library should look like below (Test sub-folder should exists):

image.png

Workflow Description:

  1. First, add a Microsoft Office 365 Scope activity in order to connect to Office 365 and to provide a scope for other Office 365 activities
  1. Then, add Find Files And Folders activity in order to find and return the Drive Item corresponding to "Test" folder.
    • Query := "Test"
    • Site Url := "https://yourSharePointWebsite.com/sites/Site-Name"
    • (Output) → mySharepointFolder (this represents the Drive Item object corresponding to "Test" folder)
image.png
  1. Secondly, to retrieve the Drive Item for the Documents Library root folder, use Get Item Info activity with the following values for the parameters:
    • Item ID := mySharepointFolder.ParentReference.ID (i.e. the parent of the "Test" folder drive item)
    • Site Url := "https://yourSharePointWebsite.com/sites/Site-Name"
    • (Output) → mySharepointRootFolder
image.png
  1. Upload the Drive Items files : File1.txt to mySharepointRootFolder and File2.txt to mySharepointFolder. Upload first File1.txt:
1.jpg
  1. Upload File2.txt to mySharepointFolder
2.jpg
  1. Execute the workflow
  2. Post successful execution, see the result in browserimage.png
  1. Files shall be uploaded successfully.

Printscreens are not loading. Could you update your post?

Hi @system ,

The Screenshots in the post don’t load anymore. Could you please repost it ?

Thanks & Regards,
Nithin

Hello Nithin ,

Thank you for using our Support Knowledge Base.

Try to access the KB here:
https://uipath-survey.secure.force.com/CaseView/articles/Knowledge/Upload-File-to-a-Document-Library-in-SharePoint

Thanks!
UiPath Support KB Team

2 Likes

A post was split to a new topic: While uploading a file to a new Library created ( it is not the “documents” library), is creating a sub-folder the only working way or is any other option available?

The “Get Item Info” activity is missing in Studio. I am using v24.3