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:
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:
The old folder and the new folder have the name extension. The same situation looking into the sharepoint site is:
Also duplicate folders but without the -hhMMss extension.
My Flow looks like this:
with the rename action
and the create folder action
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?
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.
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?
Hi @Expiscornovus ,
I tried that method initially because it was the first I found searching at the internet
Here is my action:
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?
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)?
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/
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.
Hi @Hendie,
Maybe you could build in a check if the folder already exists (as a workaround). I used that approach in another thread:
This way you can rule out that the duplicate folders are coming from your own automation 😉
Nobody has the same issue or any idea what could cause it?
WarrenBelz
146,552
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,928
Most Valuable Professional