Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Creating a new sharepoint folder creates duplicate folder names

(0) ShareShare
ReportReport
Posted on by 17

Hello,

I use a web flow to create a folder in a sharepoint that is holding files from a MS Team. To make sure that folder does not exist already I check the files in the father directory before creating my folder. If I find this folder does already exist I rename it by adding "-hhMMss"  and only then create my folder. The strange thing I see is, that after renaming the old and creating the new folder I get 2 folders with the same name in my Teams channel (which is the name with the -hhMMss added. Looking at the sharepoint site I also see two folders with the same name, but without -hhMMss added.

 

Situation after first run of my flow:

1st run Teams-Files.png

 Everything works like intended. The folder is created.

Now I run the same flow again. Because the folder does exist already I expect a renamed folder with an added -hhMMss and a new folder. But this is what happens:

2nd run Teams-Files.png

 

The old folder and the new folder have the name extension. The same situation looking into the sharepoint site is:

2nd run SP-Files.png

Also duplicate folders but without the -hhMMss extension.

My Flow looks like this:

Flow.png

 with the rename action

Rename Action.png

 

and the create folder action

Create Folder Action.png

 

I do not understand where the duplicate folders come from. Even more strange, if I delete one of the duplicate folders in Teams, the other folder suddenly appears without the -hhMMss part added to the name.

 

Any ideas what causes this behavior?

 

  • Verified answer
    Hendie Profile Picture
    17 on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hello @Expiscornovus 

    I tried it with the bNewDocumentUpdate property yesterday, but the behavior does not change.

     

    Then I found out that the reason for the issue with the double folder names is a refresh bug in Teams as well as in Sharepoint online. Usually, I deleted the double folders before shutting down my PC but yesterday I forgot to delete them. So today, when I opened Teams again, I saw the correct (different) folder names where yesterday the same folder names had displayed.

    I tried it again today and ended up with the double folder names displayed in Teams. Then I tried to refresh the view by switching to other tabs and channels (there is no refresh menu) to no avail. Whenever I returned to my folders, they still had the same name. Only when I logged-out of teams and back in again did I suddenly see the

    correct folder names.

    Also, Sharepoint online has a refresh issue.  The creation of a folder triggered a new line in the folder view, but the rename never triggered a refresh. I also ended up in Sharepoint online to have double folder names. When I manually trigger a refresh of the whole page, I get the correct folder names.

     

    Thanks for your suggestions.

  • Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hi @Hendie,

     

    I see you are not using the bNewDocumentUpdate property. When set to true that should update the item without incrementing a version.

     

    Can you add that property with the true value to the json payload in your body field and see if that makes a difference?

     

    Btw, another question. What is the trigger for your flow?

  • Hendie Profile Picture
    17 on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hi @Expiscornovus ,

     

    I tried that method initially because it was the first I found searching at the internet

    Here is my action:

    ValidateUpdateListItem.png

     

    It has the same result in doubling the Folder names.

     

    When I look at the details of both files in Teams, I see the Title and Name are different. Title for both is the original folder name and Name is the renamed folder name. Is it a problem that Title and Name have different values?

     

    In my last test I had both folders with the extended Name. Then I deleted one of them and the other folder immediately changed its name back without me doing anything. It looks like the renamed folder details sort of over-shadow the newly created folder and once the renamed folder is deleted the underlying details get visible.

    Does this make any sense to you?

  • Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hi @Hendie,

     

    Apologies, I missed that part of your configuration. My bad 😅

     

    Have you tried use the validateUpdateListItem method instead to rename the folder, to see if that makes a difference (or if it still creates duplicates with that approach as well)? 

     

    validateupdatelistitem.png

     

    Also have a look at this blog form @ekarim2020 about this approach:

    https://elliskarim.com/2021/07/31/renaming-sharepoint-file-using-rest-api-with-power-automate/

     

  • Hendie Profile Picture
    17 on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hello Expiscornovus,

    thanks for your kind proposal, but that is what I do already. See my action "Check if folder exists already". In the second run it will exist because I created it in the first run. If it exists already, I rename it and then create the folder. This is how strangely the two folders with the same name show up.

  • Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Hi @Hendie,


    Maybe you could build in a check if the folder already exists (as a workaround). I used that approach in another thread:

    https://powerusers.microsoft.com/t5/Building-Flows/SharePoint-Create-Folder-with-special-character/m-p/1787311/highlight/true#M197603

     

    This way you can rule out that the duplicate folders are coming from your own automation 😉

  • Hendie Profile Picture
    17 on at
    Re: Creating a new sharepoint folder creates duplicate folder names

    Nobody has the same issue or any idea what could cause it?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,552 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow