cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BTHB
Frequent Visitor

I built a flow for archiving or deleting files older than 7 days but its including folders

I built a flow with a recurrence schedule to run daily to archive or delete based on old files (older than 7 days) with user input from notification email. The issue is it also emails for approval about the folder names within Documents library - I just want to notify about the files within the folders or target a folder within the library. How do I do that?

 Screenshot_1.png

 

15 REPLIES 15
Super User
Super User

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hey @BTHB

 

 

 

There is a SharePoint property that is called IsFolder.

If you use this you can check whether it is a file or folder.

If it is a folder you should do nothing, if it is a file you can do your other actions.

 

Hope this helps

 

Kind regards

 

 

Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Thanks Tom

I tried this but I get no notification email at all because I set the value of isFolder to true and put my actions under "If no"

 

see below

 Screenshot_1.png

 

BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

heres the output of the flow 

 

Screenshot_2.png

Super User
Super User

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hey @BTHB

 

 

I know it is annoying but you have to use the expression to make it equal to true.

So you have go into the field and choose Expression and type true and click the expression, then click Ok.

True_Expression1.PNGTrue_Expression2.PNG

 

 

 

 

 

 

 

 

 

 

Kind regards

 

 

Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hi Tom,

 

I actually did do that as I understand how the expression works. It appears to be skipping the "if no" actions since the condition is true. The screenshot above is what the results are.

 

Thanks

HB

 

Super User
Super User

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hey @BTHB

 

 

 

Weird because if I replicate your Flow it works fine with me, well fine the Flow keeps running and I canceled the Flow but I still got the email for it.

 

So it is weird that your Flow doesnt want to go through.

And did you use the expression with true like i described in my previous message?

 

Kind regards

 

 

Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hi Tom

I will try again but I can also export my flow and send it to you if you like so you can see if you can reproduce the issue.

 

Thanks

HB

BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

The condition is still not satisfied

Is it because i am using a nested condition? 

 

see.png

Super User
Super User

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hey @BTHB

 

 

You can export your Flow, I will look into it.

And will let you know if I find something

 

Kind regards

 

 

Tom





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Community Support
Community Support

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hi @BTHB,

 

Could you please share a full screenshot of your flow's configuration?

Do you add two filter Conditions to check if the item is a folder within your flow?

 

I think it is not necessary to add two filter Conditions to check if the item is a folder within your flow, I have made a test on my side and please take a try with the following workaround:

  • Add a Recurrence trigger, Interval set to 1 and Frequency set to Day.
  • Add a "Get files (properties only)" action, specify Site Address and Library name.
  • Add a "Apply to each" action, input parameter set to output of "Get files (properties only)" action.
  • Within "Apply to each" action, add a "Get file metadata" action, specify Site Address and File Identifier field set to Identifier dynamic content of the "Get files (properties only)" action.

         Add a Condition, left input box set to IsFolder dynamic content of the "Get file metadata" action, right input box set to true, within middle drop down, choose is equal to.

 

        Within "If/no" branch of Condition, add a Condition 2, click "Edit in advanced mode", type the following formula:

@equals(utcNow('MM/dd/yyyy'), formatDateTime(addDays(item()?['Created'], 7), 'MM/dd/yyyy'))

Within "If/yes" branch of Condition 2, add a "Start an approval" action.

 

Image reference:17.JPG

 

18.JPG

 

 

Note: Under the "Start an approval" action, you could add other actions that you needed.

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Kris thanks for the detailed flow! I attached the updated flow based on what you provided.

 

The flow does run successfully this time however it is still including the folders in the approval email, see below please. In this example, General is the folder name. If I choose an action, eventually I get a notification email for the documents in the folder but I want to exclude folders from in the notification email since the flow only works against files. 

 

 approvals.png

 

 

 

Attached is the flow built below

 

flow1.pngflow2.pngflow3.png

BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

any update on this would be appreciated 

BTHB
Frequent Visitor

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

bump

Diego
New Member

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

The flow in the following post could give a solution to your problem using a query filter:

 

Flow

Administrator
Administrator

Re: I built a flow for archiving or deleting files older than 7 days but its including folders

Hello, @BTHB!

Have you had an opportunity to apply @Diego‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify! Thank you for being an active member of the Flow Community!

 

-Gabriel

Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (5,969)