web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how do I delete an ema...
Power Automate
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

Categories:
I have the same question (0)
  • v-yuazh-msft Profile Picture
    on at

    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

  • jmrstrong Profile Picture
    2 on at

    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. 

  • MikefromGeramny Profile Picture
    4 on at

    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

  • Community Power Platform Member Profile Picture
    on at

    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

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard