How to create folder in sharepoint uipath

Hi UiPath Team,

How to create folder in share point i try to use find files and folders but it is not available now then i try to use for each file or folder but it is throwing error “advanced search is not when using personal microsoft accounts or using Application ID” even though i have passed application id and use simple search but it is throwing the same error

@Alan_Prakash1

If you are using latest then its a direct selection

Cheers

Hi @Alan_Prakash1

Use a work or school Microsoft account instead of a personal account. Ensure your Azure AD application has SharePoint API permissions like Sites.ReadWrite.All. Use the HTTP Request activity to call the SharePoint REST API. Use the endpoint POST https://<site_url>/_api/web/folders to create the folder.

You can also refer below link:

If you found helpful, mark as a solution. Thanks

if we want to create folder like Now.ToString(“yyyy”)/Now.ToString(“MMM”) is it possible will it create subfolders?

@Alan_Prakash1

use the output of this and use another create folder

cheers

when i use this create folder it is throw error caller doesnt have the permission to perform the action eventhough we have given the access

@Alan_Prakash1

if access is there it would not throw…

can you shoe the exact error and what access did you provide..and what authentication are you using?

cheers

i have given authentication type as application id and secret i cant able to show the screenshot its in the client server error it is showing is “caller do not have the permission to perform the action” when i used create folder

@Alan_Prakash1

In your azure app can you check if write permissions are present

Also check may be at a folder level you might not have write

Alternately try to change the o365 version and check

Cheers

it was the permission issue now i can able to create the folder in sharepoint, but if we again run that it throws error “specified item name already exists” how can i overwrite the same folder name if we give the option autorename it will rename it any solution

@Alan_Prakash1

glad it helped and you resolved the previous error

now for same name there is no option as such but you can use find files/folders first to check if the folder exists and then if not create else dont or change name and create

cheers

Hi @Alan_Prakash1

Unfortunately, SharePoint does not support direct folder overwrite. The best approach is to check if the folder exists and use “Create folder” with the “Auto Rename” option to avoid renaming, but it will not overwrite the existing folder directly without deletion.
check below link:

If you found helpful mark as a solution. Thanks

Happy Automation.

Here is my use i have 2 transaction in the 1 st transaction i need to download some documents from one website after i download all this i need to upload in the sharepoint, like One specific folder is always there in the Sharepoint, inside that folder i need to create folder as Now.ToString(“MMM”)_Now.ToString(“yyyy”) inside that folders i need to create sub folder TransactionName/Documents inside that documents folder i need to upload some files this will work for the 1st transaction but when it come to the second transaction it will throw error at create folder this part Now.ToString(“MMM”)_Now.ToString(“yyyy”) is there is any other approach i can do if i use folder exists also how can i take the output of the folder that i have created

Hi @Alan_Prakash1

Generate folder name using Now.ToString(“MMM”) & “_” & Now.ToString(“yyyy”)

Use Find Files and Folders activity in SharePoint to check if the folder exists

If the folder exists, get the folder path; if not, use Create Folder activity to create it

Use Create Folder activity again to create TransactionName/Documents inside the main folder

Use Upload File activity to upload documents into the Documents folder

Find Files and Folder activity now it is not there i guess

@Alan_Prakash1

You can use Get File or Folder activity, which is part of the UiPath.MicrosoftOffice365.Activities package, to interact with both OneDrive and SharePoint, allowing you to retrieve files and folders from either location.