cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
r96359
Helper IV
Helper IV

Using "Retrieve email messages from Outlook" to download attachments one at a time for processing

Hello All,

 

I need to look for unread emails based on subject heading then save a specific xls attachment that always comes on this email. I would like to handle this attachment as a variable then open it, copy data from it and add it to a xlsx master template. Repeating this sequence until all emails processed that match.

 

I was using a cloud flow for some of this processing but scope has changed and it can't be real time. The user wants to kick off this automation manually and have it go through the emails.

 

Any ideas? Would appreciate letting me know what triggers or loops to use if possible.

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
fraenK
Memorable Member
Memorable Member

If even the body is the same then this won't work. But there shouldn't be an issue processing all saved attachments for all returned emails as they are referenced in the output variable. 

View solution in original post

9 REPLIES 9

Thank you.

The issue is that "Retrieve email messages from Outlook" downloads all attachments in one pass. Thus overwriting or renaming filename(1). I am looking for a solution that Downloads one email at a time and runs through the process of saving the attachment, processing it, then moving to the next email until all emails are processed.

 

 

r96359
Helper IV
Helper IV

@miketran13 I'm back to needing to solve this in PAD only. Really appreciate your previous help.

Would you mind answering a few questions regarding you recommendation in a previous question post?

 

Your help to clarify would be greatly appreciated!

 

1. Open Outlook

- understood

2. Retrieve email from Outlook folder to see how many emails do you have.

- understood

3. Navigating to the Outlook folder that you want to retrieve the email (Inbox or RPA folder)

- understood

4. Double click on the first email

- Would I be doing this in a recording? I don't see this as a predefined action. 

5. Save the attachment if any. 

- Would I be doing this in a recording? I don't see this as a predefined action. 

6. Process the data from the attachment

- understood

7. Move the email to the RPA Done folder if success, or Failed folder if it failed

- understood

8. Delete the files

- understood

 

Then repeat the step 2 until step 8. By using this, you will alway need to move the emails that is success or failed and then repeat the step for retreiving emails. If there is no emails that match the conditions, then the flow should be stopped.

fraenK
Memorable Member
Memorable Member

You just need to retrieve all emails matching your criteria first with disabled attachment saving. Then loop through the resulting list and run the command again with the respective email details as filter and enabled attachment saving. Process the attachment, clear the folder, next. No need for UI automation.

Brilliant @fraenK. Let me try that!

So use the variable of lets say email_list generated from Retrieve email messages 1st pass.

Then do a for each email_list item performing Retrieve email messages again with DL attachment.

So in this for each "Retrieve email messages" would only see one email at a time? 

The rest is clear, process file, remove file, next item in loop.

fraenK
Memorable Member
Memorable Member

yes, just fill the filter (from, to, subject etc.) of retrieve email messages with the details of the current email item

Thanks @fraenK 

I have all the emails coming from another system so they have the same To, Subject Heading, and file attachment name. Will this solution still work with this scenario? 

fraenK
Memorable Member
Memorable Member

If even the body is the same then this won't work. But there shouldn't be an issue processing all saved attachments for all returned emails as they are referenced in the output variable. 

View solution in original post

r96359
Helper IV
Helper IV

Thanks @fraenK . I'll give that a try.

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,593)