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

Create new folder under empty folder fail in SharePoint

Hi All,

 

It's kind of complicated. My purpose is to create 'ddmmyyyy' folder under 'yyyy' folder. I've got two conditions here:

1 to see if there is 'yyyy' folder, if not, create one.

2 to see if there is 'ddmmyyyy' folder under 'yyyy', if not, create one.

 

The flow goes well till the end and shows 'Your flow ran successfully.' somehow the step create folder doesn't have any result in the flow, neither there is new folder in the target 'yyyy' folder.

It confuses me for days since the problem never happens IF there is any file or folder in 'yyyy' folder

I've searched many topics but no related problem like this one.

Please let me know if further info is needed.  Thanks for help!

 

POMPAC_1-1620893799516.png

POMPAC_2-1620894243642.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @POMPAC ,

you can just add the new folder in the path to the new folder.

  • Create the main folder YYYY
    • Create sub-folder YYYY/MMYYYY


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
tom_riha
Super User II
Super User II

Hello @POMPAC ,

from the flow run history it seems the whole 'Condition' part of the flow is skipped because the input of the 'Apply to each' action doesn't contain any item.

Check if the 'body' input contains any items by adding it into 'Compose' action right before the 'Condition'. 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Thanks for your reply @tom_riha . It is the thing that the body contains nothing and returns an empty array in "List folder" step as below.

POMPAC_1-1620954070545.png

POMPAC_2-1620954390958.png

 

once there is any file or folder like I manually create 1 dummy file, the body will not be empty and the "Create Folder" runs perfectly. But it is the reality that on 2022 Jan 1st 0:00:00, there will be folder "2022" created first then  folder "Jan 1st" created inside "2022", It seems not so "automated" if I need to create something in the "2022" to let the rest flows run...

 

I was first trying to use "length(body) = 0" to create new folder but it fails, I also tried creating new empty array and compares with body also fails. 

 

Or is there any option to automatically create one file or folder right after the folder "yyyy" is created? I just want to solve the problem. Thanks again.

Hello @POMPAC ,

you can just add the new folder in the path to the new folder.

  • Create the main folder YYYY
    • Create sub-folder YYYY/MMYYYY


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

YES YOU ARE RIGHT!

Why not create the folder directly? 

So I change the flow as below to create month folder following the year folder without list folder, so no "empty" body check and judge, no problem.

And the folder will not be replace if the flow runs again in next circle, what an amazing logic!

Thanks so much for your help @tom_riha . Have a great day ~

 

POMPAC_0-1621217347530.png

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (57,381)