(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to automatically rename files in SharePoint with Power Automate

João Barros 20 de September de 2026 4 min read

This tutorial shows how to automatically rename files in a SharePoint library using Power Automate, useful to enforce naming standards, include the date or avoid duplicates. Learning to automate the rename action reduces manual errors and ensures file consistency.

Prerequisites

  • Account with access to SharePoint and edit permissions on the library.
  • License with access to Power Automate (standard is sufficient).
  • Files with metadata or a pattern that allow building the new name (e.g.: column "Projecto" or "Cliente").

Step 1: Flow concept and logic

Decide when the flow runs: on create/update of a file or on a schedule. The basic logic: trigger → get file properties → generate new name → check if a file with that name already exists → rename (move) if safe. We avoid overwriting by using a prior check and unique suffixes when needed.

Step 2: Create the flow and choose the trigger

In Power Automate, create an automated flow. To act immediately when a file is added/changed, choose the trigger "When a file is created (properties only)" or "When a file is created or modified (properties only)" from the SharePoint connector.

Step 3: Get file properties

Add the action "Get file metadata" or "Get file properties" (SharePoint) to read fields like Path, File name, ID and custom columns. Those values will feed the pattern for the new name.

Step 4: Build the new file name

Use the "Compose" action to assemble the new name. Example pattern: Project_Date_OriginalName.ext. Include the original extension to keep the file type.

// Exemplo de expressão para criar novo nome
concat(outputs('Get_file_properties')?['body/Projecto'], '_', formatDateTime(utcNow(),'yyyyMMdd'), '_', last(split(triggerOutputs()?['body/{Name}'], '/')))

Step 5: Check for a file with the same name

Use the "Get files (properties only)" action with the same Site Address and Library, applying an OData filter to check if a file with the new name already exists. Example filter: FileLeafRef eq 'newName.ext'. If the result contains items, we should avoid overwriting.

// Exemplo de filtro OData (coloque o nome correcto com extensão)
FileLeafRef eq 'Projecto_20260920_Ficheiro.xlsx'

Step 6: Logic to avoid duplicates

Add a condition: if the list returned by the previous step is empty, proceed to rename; otherwise, generate a unique suffix. For the suffix, you can use timestamps or a counter.

// Exemplo de sufixo com timestamp
concat(outputs('Compose_NewName'), '_', formatDateTime(utcNow(),'HHmmss'))

Step 7: Rename the file (move with new name)

SharePoint does not have a direct "rename file" action in all connectors; use the "Move file" action to move the file to the same folder with the new File name. Configure Source Site Address, File to Move (ID) and Destination Site Address and Destination Folder with the new File name.

// Exemplo de campos
Destination Folder: /Shared Documents/Folder
Destination File Name: @{outputs('Compose_FinalName')}

Step 8: Handle errors and concurrency

Add simple error handling: configure run after to capture failures and log them or send a notification. To avoid race conditions, enable versioning in the library or use a logical lock (status column) indicating processing in progress.

Verify the outcome

Check in the SharePoint library that files were renamed according to the pattern. In the flow history in Power Automate confirm that each run succeeded and that the "Move file" action used the correct final name. Test scenarios: new file, file with the same name (check suffix) and file with missing metadata.

Conclusion

With this basic flow in Power Automate you can enforce naming standards and automatically avoid duplicates in a SharePoint library. Next steps: adapt the pattern to custom columns, log renames or trigger notifications to a team. Tip: start with test files and enable versioning to revert changes if needed.