Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Add a prefix to all files and folders when a document library is used as a template

(0) ShareShare
ReportReport
Posted on by

I have a set of files and folders that I have created a document library for. We use the same document library for many clients and want to set a prefix to the specific client. 

 

For example we have the folder Year, Client Name, Project. Then we have a series of files and folders in the main folder. Each file and folder should be prefixed with the main folder name. For example the invoice file should be year client name project invoice for example. 

 

How would I accomplish this when I create a new library using the create a document library from existing library?

  • Gdarmon Outlook Profile Picture
    Gdarmon Outlook 372 on at
    Re: Add a prefix to all files and folders when a document library is used as a template

    Hi,

     

    To add a prefix to all files and folders when a document library is used as a template, you can use the Get Files (Properties only) action to retrieve a list of all files in the library and then use the Apply to each action to iterate over each file and folder. You can then use the Update file properties action to add the prefix to the file or folder name.

    Here are the steps to accomplish this:

    1. Add the Get Files (Properties only) action to your flow.
    2. In the Site Address field, specify the URL of the SharePoint site that contains the document library.
    3. In the Library Name field, specify the name of the document library.
    4. In the Filter Query field, specify the filter query to retrieve the files and folders you want to update.
    5. Add the Apply to each action to your flow and select the output of the Get Files (Properties only) action as the input.
    6. Add the Update file properties action to your flow and specify the following:
      • In the Site Address field, specify the URL of the SharePoint site that contains the document library.
      • In the Library Name field, specify the name of the document library.
      • In the File Identifier field, specify the ID of the file or folder you want to update.
      • In the File Name field, specify the new name of the file or folder with the prefix added.

    Once you have completed these steps, the files and folders in the document library will have the specified prefix added to their names.

     

    Br,

    Gill

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard