
Announcements
Hello,
Hello, I'm looking for a Power Automate flow that allows me to rename a file just added in a sharepoint folder, with the month and year + "-" as a prefix
This is how I'd build the flow.
See full flow below. I'll go into each of the actions.
When a file is created will trigger when a new file is created.
Compose builds up your new name by concatenating the current Month and Year followed by a hyphen followed by the current name.
concat(formatDateTime(utcNow(), 'MM-yyyy'), '-', triggerOutputs()?['body/{Name}'])
Send an HTTP request to SharePoint renames the file using the following.
//Method
POST
//Uri
//Note that you will need to specify the Display Name of your Library in place of Documents
_api/web/lists/GetbyTitle('Documents')/items(@{triggerOutputs()?['body/ID']})/validateUpdateListItem
//Body
{
"formValues": [
{
"FieldName": "FileLeafRef",
"FieldValue": "@{outputs('Compose')}"
}
]
}