Access to the path is denied error when deleting a folder in sharepoint (locally synced)

Hi All,

I am getting the below error when i am trying to delete a folder in SharePoint (whcih is synced locally).
I am using the below code.
System.IO.File.Delete(currentFile)

Error is : Access to the path ******* is denied.

hi @MariaJosephina

check if the complete path of the file is given. This should include the file extension of the file

Hi,

And also check manually are you able to delete the file or not some cases you should have admin access to delete files in specific folders. Thanks.

it is working manually.

Yes, it is the correct path.

I hope you are using Invoke code activity and passing the file path “currentFile” as argument. If possible if you can share the screenshot of the your workflow and properties of the activity where you are using this “System.IO.File.Delete(currentFile)” would help to further analyze this

as an alternative you can use Delete File activity to delete a specific file

Hi, Actually i wanted to delete a folder in SharePoint. (not a file in sharepoint)