Issue Uploading and Replacing File on SharePoint via UiPathTeam.SharePoint.Activities

Hello Community,

We are currently experiencing an issue with uploading and replacing a file on SharePoint using the UiPathTeam.SharePoint.Activities package in Windows Project.

:pushpin: Issue Summary:
Uploading a new file to SharePoint works fine. However, when we try to replace an existing file with the same name in the same document library, we receive the following error:
Here, I am connected the Sharepoint with Username and Password.

What We’ve Confirmed So Far:

  • The connection to SharePoint is successful.
  • Uploading a new file works.
  • File replace fails only when a file with the same name exists.
  • The user has Edit/Contribute permissions on the target SharePoint library.
  • We’ve tried using both Upload File and Create File activities.

:red_question_mark: Looking For:

  • Has anyone faced this issue with file replacement?
  • Are additional permissions or settings needed in SharePoint to overwrite files?
  • Is there an alternate approach or workaround?

Any insights or suggestions would be greatly appreciated!

Thank you

Hi @Aman_Agrawal

have you enabled allow overwrite property for your upload file activity?

ideally, if you enable same, it would replace without error unless file you are trying to replace is being used or opened by some other user

Hi @Aman_Agrawal ,

When trying to replace an existing file on SharePoint using UiPathTeam.SharePoint.Activities, common issues include the “Overwrite” property not being set to True in the UiPath activity, the file being locked or checked out in SharePoint, or tenant-level policies preventing direct overwrites.

Solutions include:

  1. Ensuring the “Overwrite” flag is enabled in the UiPath activity.
  2. Handling file locks/checkouts by either checking file status, performing explicit checkout/checkin, or using a “Delete and Re-upload” workaround (though this loses version history).
  3. Verifying SharePoint permissions beyond just “Edit/Contribute” to ensure no specific overwriting restrictions.
  4. Considering the UiPath.MicrosoftOffice365.Activities package for SharePoint Online, which can be more robust.
  5. As an advanced option, using the SharePoint REST API with the HTTP Request activity for more granular control.

Let me know if you need further assistance

@Aman_Agrawal,

What error message you get?

@Aman_Agrawal

What is the error message

Also alternately you can first delete the file and then upload as well this way there wont be any replace

Cheers

Hello Sonali,

Thanks for your reply and support.

Yes, the “Allow overwrite” property was already enabled, I had selected that option from the very beginning. However, I am still facing the same issue.

Hello Jasimuddin,

Thank you for your help and support.To answer your questions:

  1. The “Overwrite” flag has been enabled from the very beginning of the activity, but we are still facing the issue.
  2. Locks/checkouts, including checking file status and performing explicit checkout/check-in, appear to be correctly handled. There are no issues on that front. Regarding the workaround of “Delete and Re-upload,” I have already proposed this solution to the client; however, they have declined to proceed with it.
  3. The “Edit/Contribute” permissions on SharePoint, ensuring there are no specific overwriting restrictions, have been confirmed as correctly configured by the IT team.
  4. We have tried all possible options, but these require application permissions for the API. Currently, we only have delegated permissions from the client, and they have refused to grant application permissions.

Hi @Aman_Agrawal,

Thanks for the clarification.:heart:

Since the “Overwrite” flag is enabled and check-in/out is handled, the issue likely stems from delegated permissions. Some overwrite operations require application-level permissions, which you’re currently restricted from using.

As a workaround within delegated scope, you might explore the Microsoft Graph API via HTTP Request, but this too depends on the client’s Azure AD configuration.

Let me know if you’d like a sample for that approach.

Hi @Aman_Agrawal

Is there a specific reason you have considered using this package instead of Microsoft O365 package?

If not, I would suggest moving to Microsoft package as that is a quite stable package and support is also offered from UiPath on same. The sharepoint package you are using currently is a marketplace package and UiPath doesn’t offer support for same.

We were also using this package for quite some while but then we landed into a deadlock when there was no equivalent windows based version released for years. So we switched.

Also, this windows based package is released quite recently, so I am not even sure if this is a bug in the package as I have not tested upload functionality using the one.