cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hendie
Frequent Visitor

Creating a new sharepoint folder creates duplicate folder names

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

7 REPLIES 7
Hendie
Frequent Visitor

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

Expiscornovus
Super User
Super User

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...

 

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


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
Super User
Super User

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/

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


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
Super User
Super User

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?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


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.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (6,729)