cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cfnwfwmd
Helper I
Helper I

Automatically deleting files in OneDrive after X Days

I'm attempting to make a flow that deletes files in OneDrive older than X days.  The flow executes but the files remain in the directory, and I'm trying to figure out what I'm doing wrong. 

 

The expression is 

utcNow('g')  GREATER THAN  formatDateTime(addMinutes(item()?['Created'],1),'g')
 
which I thought would delete files older than 1 minute.   

 

 

cfnwfwmd_1-1612554831270.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User III
Super User III

Hi @cfnwfwmd 

 

You can use a Compose action and put the 2 expressions in the compose. This will help understand what the formatting of the time looks like.

 

As you have seen in the Conditions block, in the run history, you cannot see what the expressions being evaluated are.

But adding a Compose, you will be able to see.

Jcook_0-1612555512575.png

 

In the run looks like this:

Jcook_1-1612555554576.png

 

As shown above, then compose gives us visibility in what our condition is doing.

 

 


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

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

3 REPLIES 3
Jcook
Super User III
Super User III

Hi @cfnwfwmd 

 

You can use a Compose action and put the 2 expressions in the compose. This will help understand what the formatting of the time looks like.

 

As you have seen in the Conditions block, in the run history, you cannot see what the expressions being evaluated are.

But adding a Compose, you will be able to see.

Jcook_0-1612555512575.png

 

In the run looks like this:

Jcook_1-1612555554576.png

 

As shown above, then compose gives us visibility in what our condition is doing.

 

 


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

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

I'm a little confused about where the compose step would go in the flow.  

Hello @cfnwfwmd 

 

Put the Compose inside the Apply to each loop.

 

I wrote a blog post on this here:

Check Conditions In Power Automate During Run – Flow Alt Delete – Josh Cook [Microsoft MVP]


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

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (965)