Update file name is a SharePoint document library folder

One of my projects, i got a requirement to change the file names in SharePoint document library folder. We can update the document name using the steps below.

Get SharePoint files in a folder using the Fet SharePoint files action below,

On each file update the file name using Send HTTP action with following details.

Site Address: <<Site Address>>
Method: Post

Uri: _api/lists/GetByTitle('<<Document Library Name>>')/Items(<<ITEM ID>>)

Headers:

Content-type: application/json
IF-MATCH: *
X-HTTP-METHOD: PATCH
Body:
{'__metadata':
{'type':'<<SharePoint Document type>>'},
'FileLeafRef':'<<File Name to be Updated>>'}



We can get the type of the document in the body, (for me it is SP.Data.Shared_x0020_DocumentsItem) by accessing the api URL and check for the "term" in the url as below.



Comments

Popular posts from this blog

Linksys Wireless Connection Failure

The security validation for this page is invalid. Click Back in your Web

Power Apps toPower Automate Error - The input body for trigger 'manual' of type 'Request' did not match its schema definition , the input String does not validate against the date