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

automatically create flow for new user folder structure

Hi guys,

Have a question,

 

Scenario: User 1 creates a folder in the documents library on sharepoint for a new employee named Jane, they then go into Jane's folder and have to create 3 sub folders.

Everytime a new employee joins the same process needs to be repeated.

Is there a way where you can create a flow that by everytime a new folder is created in a document library that within that folder 3 sub folders are copied into it or created.

I have setup a flow to copy folders from a library to another library when a new item is created but I need it to reside WITHIN the new folder and not just create 3 more folders on the home directory.

Is there a way to do this?

11 REPLIES 11
v-duann-msft
Community Support
Community Support

Hi @jhalk123

 

Thank you for posting.

 

According to your description, you would like to copy folder to another library and create several subfolders inside. If any misunderstanding, please kindly let me know.

 

If that’s the case, please refer below flow steps.

v-duann-msft_0-1620187346079.png

 

Once tested, the created folder(Folder name equals to John here) will be copied to another library and three new subfolders created as well.

v-duann-msft_1-1620187346084.png

 

v-duann-msft_2-1620187346086.png

 

Hope the content above may help you.

 

Best regards,

Anna

jhalk123
Regular Visitor

Hi Anna,

 

Thanks for this, so kind of...

 

Basically we want a flow of the following scenario

 

I go create a new folder in location TEST\DOC

 

I call that folder Samantha

 

In that new folder Samantha it would then automatically create 3 sub folders called test1 test2 test3

 

the next day i would create another folder called Brett in the location TEST\DOC

 

it would then automatically create 3 subfolders within BRETT called test1 test2 test3

 

Am i making sense? haha

Hi @jhalk123

 

Thank you for your update.

 

So based on your explanation, the test1/test2/test3 folders are located in the same folder and they are in parallel.

 

Please pay attention to folder location here. The subfolders can't be created under 'TEST\DOC'. Otherwise, it will cause infinite looping issue. Thus, I add a 'copy folder' action to copy the original folder to another location and then create subfolders under new location.

 

If that’s the case, we can modify flow as below:

v-duann-msft_0-1620197312934.png

 

In yes branch:

v-duann-msft_1-1620197312943.png

 

After testing, I’m able to get the three subfolders.

v-duann-msft_2-1620197312946.png

 

Hope it helps.

 

Best regards,

Anna

jhalk123
Regular Visitor

Ok,

 

But if the document library structure is such of

 

H1\Clients

 

and then everytime we create a new folder in clients - eg: John 

 

In John those 3 subfolders will be automatically created?

 

or is that going to cause an infinite loop? Also...do you have to edit the flow of the name every single time or does the Name field just generate from whatever is created folder wise?

Hi @jhalk123 

 

In John those 3 subfolders will be automatically created?

Yes, if we configure flow like that, the three subfolders will be generated automatically. You can configure to check result.

 

or is that going to cause an infinite loop?

If we set up to make subfolders created under 'H1\Clients\username', it will cause looping issue. Because this location is still within the trigger scope.

 

For example, If we first manually create a folder called 'Brett' under 'H1\Clients'. So the folder path will be like 'H1\Clients\Brett'. Then flow goes and create subfolder test1/2/3. When flow creates test1, The flow detect a new folder created under 'H1\Clients' and it starts again for folder test1, That's why I recommend we can change to another folder path as destination.

 

do you have to edit the flow of the name every single time or does the Name field just generate from whatever is created folder wise?

The main folder is created by user manually. What we need to do is just replace the site address/ folder location and the subfolder name in the flow. 

 

If this solution can't achieve your purpose, I'm afraid it's impossible to do that using flow.

 

Best regards,

Anna

jhalk123
Regular Visitor

or is that going to cause an infinite loop?

If we set up to make subfolders created under 'H1\Clients\username', it will cause looping issue. Because this location is still within the trigger scope.

 

For example, If we first manually create a folder called 'Brett' under 'H1\Clients'. So the folder path will be like 'H1\Clients\Brett'. Then flow goes and create subfolder test1/2/3. When flow creates test1, The flow detect a new folder created under 'H1\Clients' and it starts again for folder test1, That's why I recommend we can change to another folder path as destination.

 

---

 

So would this only work in a hierachy in a document library eg: Clients (Document Library) 

 

and not H1\Clients

 

In other words the document library must not sit within a current folder structure but must be the top of the structure yes?

Hi @jhalk123 

 

Yes, you are correct! 😀

 

Best regards,

Anna

jhalk123
Regular Visitor

Hi Anna,

 

Having an issue with creating this, it didnt seem to work and not sure where i went wrong

 

attached are screenshots of my setup, the only difference i can see in my setup vs yours is that on the first step i have clients as the folder and its not blank like yours? would that make the difference?

 

jhalk123_0-1620351171368.png

 

jhalk123_1-1620351251355.png

 

The "Clients" folder is located on the root of the shared documents library, the idea as mentioned is a person creates a folder within clients and that subsequently creates 3 sub folders within it.

 

Thanks in advance 

 

 

Hi @jhalk123 

 

Thank you for your attempts.

 

Based on your flow, here is how your flow goes:

1.Seems you would like to trigger when new file created in 'Clients' folder only;

2.Then, you copy this folder in 'Clients' folder again with a new name;

3.After that, you create another two folders at the same folder level as 'Clients'. 

 

The step 2 may cause looping issue. Because when we copy file again in the 'Clients', the flow will go again forever.

 

Best regards,

Anna

jhalk123
Regular Visitor

So how do i resolve this Anna? @v-duann-msft 

jhalk123
Regular Visitor

Hi @v-duann-msft 

 

Any help regarding this would be appreciated...running out of time now to get this sorted.

 

Thanks in advance!!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,398)