Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Flow to delete emails still keeps running

(0) ShareShare
ReportReport
Posted on by 901

Hello Power Automate users.

 

I have created a Flow to delete emails from a certain folder in Outlook after 24 hours.


It seems to work but the runs remain running when the mail is deleted.

I don't think this is desirable, right?
Do I have to adjust something in the flow so that the run stops when the mail is deleted that is in it for 24 hours?

 

14-9-2022 07-54-47.png

 

14-9-2022 07-54-17.png

  • frixel Profile Picture
    901 on at
    Re: Flow to delete emails still keeps running

    @hongdet Thank you for your clear explanation.
    But this flow doesn't clean up mail that is older than a dad, even if the mailbox is already empty?

  • hongdet Profile Picture
    133 on at
    Re: Flow to delete emails still keeps running

    Hi @frixel ,

     

    No worries! 🙂 

     

    Sky is the limit for Power Automate, despite with no known built-in functionality on the platform, there's always another workaround to get the requirement fulfilled. I've done with quite an amount of workaround on the flows that I've built, taking this as an example; we use string to do comparison instead of using datetime directly 😛 

     

    I guess you'll have to google around a little more or wait for another expert coming in here to suggest an alternative method to achieve your requirement 😉

     

    You might want to clean up your mailbox for the very first time (for mails way older then 24 hours) and thereafter this flow should do the job by cleaning it up on a daily basis. 

     

    All the best! 

     

    BR,

    hongdet

  • frixel Profile Picture
    901 on at
    Re: Flow to delete emails still keeps running

    Hey @hongdet 
    Yes that is what i mean, (sorry for my bad English 😂)

     

    Ahh that's a shame because that's the goal of this flow.
    Delete email older than (for example) 24 hours.

    I've copied various flows using google/forum, but it seems (almost) impossible to make this.

  • hongdet Profile Picture
    133 on at
    Re: Flow to delete emails still keeps running

    Hi @frixel , 

     

    I'll try my best to understand what you mean, I think you are asking where to set the amount of time for the email to be deleted right?

     

    If that the case I'm afraid I can't help much, as I state initially I think the Condition action cannot compare datetime (or at least I'm not sure how that could be done). What we are doing here is basically comparing 2 string value (not date) and execute action upon matching. 

  • frixel Profile Picture
    901 on at
    Re: Flow to delete emails still keeps running

    @hongdet 
    where can I set after how much time (for example older than 24 hours) the flow will delete?

  • hongdet Profile Picture
    133 on at
    Re: Flow to delete emails still keeps running

    Hi @frixel ,

     

    Opps! I missed that out, it should be an "null" expression.

     

    Hope it works! 

  • frixel Profile Picture
    901 on at
    Re: Flow to delete emails still keeps running

    Thanks @hongdet 

     

    I go to try to copy what you discripe. only this step is empty.

     

    15-9-2022 13-59-20.png

  • hongdet Profile Picture
    133 on at
    Re: Flow to delete emails still keeps running

    I'm not sure if the Condition action allows the checking of datetime format. 

     

    I would set the scheduled flow to run at 11.55PM every day. Thereafter, convert today's date and email receive's date to string before trying to match it using the condition action. 

     

    hongdet_0-1663231526870.png

    hongdet_1-1663231763192.png

     

    Hope this helps! 

  • frixel Profile Picture
    901 on at
    Re: Flow to delete emails still keeps running

    @fchopo @Sundeep_Malik @Srini007 

    I can`t get the flow working.

     

    I have now this and that is running without error but i don`t understand it.

    Flow.png

     

    There is no difference in output when i changed the expression with -1hours or -12hours.

    And is my Condition okay?

    I think that mus be >The received date/time from the mail is before the convert time zone than delete.

    Am i thinking right?

     

    14-9-2022 22-04-20.png14-9-2022 21-42-41.png

  • Sundeep_Malik Profile Picture
    6,482 on at
    Re: Flow to delete emails still keeps running

    @frixel 

    You can also call me a noob for this. haha.

    I have never used it because, there was no such requirement till now. 

    Just happen to know about it.

    Found this link that might help you:

    Convert Time Zone in Power Automate(MS Flow) – Vblogs

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1