cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Benmcartney
Regular Visitor

When a file is created in a folder, but not subfolder

I have created a flow that when a folder is created in a specific location in sharepoint, it will create a sub-folder within it. 

However, if I create another folder in the new one I have created, it triggers a loop and creates a new folder 'with the same name' in the original location with the sub-folder added.

 

How can I make the trigger only happen when a folder is created in a specific location, and not when a folder is created within a sub-folder in this specific location?

1 ACCEPTED SOLUTION

Accepted Solutions
grantjenkins
Community Champion
Community Champion

On your trigger you can add a trigger condition to check the path to see if it's within your or not.

 

See example below where I only want the flow to run when the file/folder being created is directly within the Clients folder.

 

//Only trigger if the item was created at the top level of our Clients folder
@equals(triggerOutputs()?['body/{Path}'], 'Documents/Clients/')

 

To add Trigger conditions, on the trigger click on the three dots ... then click on Settings and Add under Trigger Conditions.

 

grantjenkins_0-1669644267678.png

 

In my example below, I've got two triggers. If it's in the Clients folder and only if it's a folder that was created. If you only wanted to trigger it to work with files (and not folders) then you could set that condition to false.

 

grantjenkins_1-1669644363013.png

 

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

2 REPLIES 2
grantjenkins
Community Champion
Community Champion

On your trigger you can add a trigger condition to check the path to see if it's within your or not.

 

See example below where I only want the flow to run when the file/folder being created is directly within the Clients folder.

 

//Only trigger if the item was created at the top level of our Clients folder
@equals(triggerOutputs()?['body/{Path}'], 'Documents/Clients/')

 

To add Trigger conditions, on the trigger click on the three dots ... then click on Settings and Add under Trigger Conditions.

 

grantjenkins_0-1669644267678.png

 

In my example below, I've got two triggers. If it's in the Clients folder and only if it's a folder that was created. If you only wanted to trigger it to work with files (and not folders) then you could set that condition to false.

 

grantjenkins_1-1669644363013.png

 

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

That worked! Thankyou so much

 

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 (4,318)