web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating a new sharepo...
Power Automate
Unanswered

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?

 

Categories:
I have the same question (0)
  • Hendie Profile Picture
    17 on at

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

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    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

    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
    33,189 Most Valuable Professional on at

    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

    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
    33,189 Most Valuable Professional on at

    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?

  • Verified answer
    Hendie Profile Picture
    17 on at

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard