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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create some subfolders...
Power Automate
Unanswered

Create some subfolders inside the new SharePoint folder

(0) ShareShare
ReportReport
Posted on by 10

Hello.

 

I am trying to achieve that once a new folder is created in the SharePoint root, 3 subfolders will be automatically created inside that folder.

 

What I did. 

Artemast26_0-1706644870886.png

And everything works well except that case:

 

Creating any subfolders in any folders will trigger the flow even if they are not in the root directory. Let's call it "B" (children of A).

The location of the "B" folder is -----> /Shared Documents/A/B

 

After the triggering the result will be 

 

/Shared Documents/A/B/QA

AND

/Shared Documents/A/B/Shipping

(we have 2 folders inside the B)

 

but 

 

at the same time, the B folder will be created in the root directory (aka Share Documents)

 

AND

/Shared Documents/B/Shipping

 

So, I suppose, it triggers multiple times because of the creation of 2 new folders Shipping and QA.

 

How can I avoid that and create subfolders only for those that were created in the "Shared Documents/" directory?

 

@

Categories:
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @Artemast26 ,

    Could you add a condition after the trigger to verify if the created folder is a top-level folder or not? I suggest leveraging the Path property of the trigger should work. The remaining logic can be encapsulated within the branch that fulfills the condition

     

     

  • Artemast26 Profile Picture
    10 on at

    Yes. I tried such an approach. It will not work because the "Path" returns a string in a format like "Shared Documents/A" if it was created inside the "Shared Documents/".

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    You can achieve this by checking the value of the expression length(split(Path, '/')). If the result is greater than 1, it indicates that the folder is a subfolder

     

  • Artemast26 Profile Picture
    10 on at

    @SudeepGhatakNZ 

    Hey. Perfect. It seems works. One more question. Is there a way how to change the color of the created folder? Shipping folder has to be red.  

    Can I specify in the "Create Folder" block?

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    You can achieve that by using the following REST query 

    _api/foldercoloring/stampcolor(DecodedUrl='/sites/<site name>/<Library name>/<Folder name>'

    The color goes in body

    {   "coloringInformation": {     "ColorHex":"14"   } }

    Hope that helps!

    Reference: Colored Folders in SharePoint using Power Automate - Powering your Apps (sudeepghatak.com)

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 282 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 119

Last 30 days Overall leaderboard