Sharepoint activity - 401-Unauthorized error when trying to upload file to Sharepoint

I’m trying to use the “Upload file” activity in UiPathTeam.SharePoint.Activities package 1.3 version. The credentials I have given is correct and I’m able to upload a file manually to the sharepoint. But using the “Upload file” activity, unauthorized error is thrown. Could you please check whether the format of Item URL or Local path is fine? I tried multiple combinations of the Item URL, but getting same error.

Error: RemoteException wrapping System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Item URL: “Documents\RPA\New\Sample.xlsx”
Local Path: “C:\Users\vijayakumar.chandran\Desktop\Sample.xlsx”

1 Like

Hi @ Vijay_chandran,

see this post will help you

1 Like

Thanks for the reply @Luis261980. I have gone through this post. In the Item URL I have mentioned the sharepoint library name at the beginning but still facing the same error.
Note: I have used “Create Folder” activity in Sharepoint scope and that is working fine, so the credentials used to connect are correct.

@radu_bucur - FYI please.

Try full path on ITEM URL

Hi @Luis261980 - I have tried below paths in ITEM URL, getting same unauthorized 401 error for all. But using Create Folder activity, I’m able to create folder in the same sharepoint path.

ITEM URL tried:
“C&H-Work Meeting Prep/Documents/RPA/Sample.xlsx”
“/C&H-Work Meeting Prep/Documents/RPA/Sample.xlsx”
Sign in to your account
Sign in to your account
Sign in to your account

Wait i will call the cavalery :slight_smile:





@ sudhasagar

@ Palaniyappan

any help here please, tnhx

1 Like

Try “/Shared Documents/RPA/” it might work.

If you say Create Folder is working fine and that you indeed have permissions to upload files, this should work too. If it doesn’t, please go through the questions below
Are you trying to overwrite a new file or to upload a new one?
If you want to overwrite, are u sure the file is not checked out or that someone is editing it?
Could you possibly share the code with us? (minus the credentials) This way we could see if there indeed is a problem.

1 Like

Thanks Radu. The file gets uploaded to the sharepoint by using “/Shared Documents/RPA/” Note: I was getting a different error (File not found) even after successful upload with above mentioned URL. Then I changed the Item URL to “/Shared Documents/RPA/Sample.xlsx”, after which I’m not getting error.
Thanks lot for your help.


No problem, its something that’s specified in the documentation of the package. SharePoint has certain exceptions like that (SharePoint be crazy). Glad it worked out!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.