Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

how do I delete an email once i have saved attachment

(0) ShareShare
ReportReport
Posted on by

 

Hi,

 

I have been looking at the Microsoft FLOW inbuilt for saving attachments.

It seems to be pretty easy to tag it to scan for emails from specific sender and save attachments.

 

What' I'm looking to do, however is the following, (and I cannot see how to pass Email ID code).

 

1.  Scan a subfolder in INBOX

2.  Look for emails from DocUpdates@contoso.com

3.  Save the attachments from those emails in OD4B/Documents/Updates/Daily

3a.  If a similarly named attachment document already exists, silently overwrite it, as the one received today is the latest one.

4.  Then DELETE that single email from the exchange inbox subfolder.

 

 

Any ideas?

 

Many thanks,

 

Gavin

  • MikefromGeramny Profile Picture
    4 on at
    Re: how do I delete an email once i have saved attachment

    Exactly. Simply use the name to be used and it will overwrite. 

  • Community Power Platform Member Profile Picture
    on at
    Re: how do I delete an email once i have saved attachment

    Hi Mike,

     

    So are you saying that the upper poster may be incorrect?  If it saves with the file, then it WILL silently overwrite?

  • MikefromGeramny Profile Picture
    4 on at
    Re: how do I delete an email once i have saved attachment

    It is not necessary to delete the file. Simply use the same name as already in the folder when saving.

    MikefromGeramny_0-1678870448168.png

    Doing this is overwriting the file and not adding any 1-2-3 at the end of the file name

  • jmrstrong Profile Picture
    2 on at
    Re: how do I delete an email once i have saved attachment

    Regarding replacing an existing file... 

     

    I faced the same issue. I deleted the existing file and then created the new file to replace it. That worked for me. 

  • v-yuazh-msft Profile Picture
    on at
    Re: how do I delete an email once i have saved attachment

    Hi @ GavinW-Work,

     

    Could you please explain more about the path "OD4B/Documents/Updates/Daily" to save the email attachments in your step3?Is it a file path in your Onedrive for business?

     

    I would offer you a work around for your step1,2,3,4 to save the the email attachments to the path in your Onedrive for business.

     

    However,for your step 3a to overwrite the attachment if the attachment is exist in the folder, it's not supported in microsoft flow Onedrive for business connector currently,I afraid that there is no way to achieve your needs in Microsoft Flow Onedrive for business connectorcurrently.

    If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

     Please refer to screenshot below to create the flow to achieve your step1,2,3,4:

    Capture.PNGCapture1.PNG

     

    Note:

    1. The folder1 is a subfolder in inbox.

    There is a limit in the amount of emails that the “Get emails” action retrieves, the “Get emails” action could only retrieve at most top 25 emails once, if your e-mails is not in top 25 emails, the “Get emails” action would not retrieve it.

     

    2. Add a "Create file" action inside the "Apply to each 2", choose the file path in the "Folder Path"field of  "Create file" action with folder picker. Choose the "Name" (Attachment name)dynamic content in the "File Name" field,Choose the "Content" (Attachment content) dynamic content in the "File Content" field.

     

    3. Add a "Delete email" action outside and under the "Apply to each 2".

     

    The flow would run successfully to save the email attachments which is sent by "xxxx@xxxxx.com" to the path in Onedrive for business,and then delete the email as screenshot below:

    Capture.PNG

     

     

     

     

    Regards,
    Alice Zhang

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