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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Saving sending outlook...
Power Automate
Answered

Saving sending outlook email or reply outlook email in Folder

(0) ShareShare
ReportReport
Posted on by 39

Hi

I have a list of Supplier with their outlook emails

Once supplier will have several  outlook email

I wanna create a Flow that allow to save all emails related to each supplier and save them into Folder

It mean that  supplier's email in .From or .To or .BCC will be save into each Supplier Folder

 

So how can I make it?

 

 

Atngocnguyen_1-1691489257404.png

 

 

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    What have you done so far and what are you struggling with?

  • Atngocnguyen Profile Picture
    39 on at

    Hi, 

    Yesterday, I did as your suggestion:" do Retrieve email 3 time: ..From , .To , .CC, . However, in Retrieve email, there is no Filter for .CC --> So, it cannot be working.
    Therefore, I did only 1 Retrieve email to retrieve all email . However, because Supplier's email will appear in From.  or .To, or .CC. So, I don't how to recognize which email belongs to which Supplier, then can Move this email to their Folder. 


     

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you retrieve all emails, then you will need to build a loop and iterate through them to check each email separately. Your loop could look like this:

    Agnius_0-1691555538581.png

    It will have a condition that checks if either of the 3 fields contain an email address that you set before the loop and if they do, it will save the message to a folder.

    You will clearly need to add some actions for actually generating the email address to search for, as well as the folder. But this will at least give you an idea of how to check for it.

     

    Here's a snippet of the loop that you can copy and paste directly into PAD:

    LOOP FOREACH CurrentItem IN RetrievedEmails
     IF (Contains(CurrentItem['From'], EmailAddress, False) OR Contains(CurrentItem['To'], EmailAddress, False) OR Contains(CurrentItem['Cc'], EmailAddress, False)) = True THEN
     Outlook.SaveOutlookEmailMessages.SaveEmails Instance: OutlookInstance Account: Account EmailsToSave: CurrentItem SaveFormat: Outlook.MessageType.OutlookMessageFormatUnicode SaveEmailsTo: Folder MessagesFiles=> StoredMessagesFiles
     END
    END

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Atngocnguyen Profile Picture
    39 on at

    Hi, I did as your suggestion. However, I found out that if Supplier has several emails and when they send an email to us, they will put some of their emails in CC  

    Therefore, If I retrieve their emails based on email list, there are so many emails with the same content were saved

    Is there any way to solve it ? Just saving email only 1 time?. 

    I did not found "Overite function or sth...."

    Atngocnguyen_0-1691629980692.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you are okay with that, you could not mark the emails as read when you use Retrieve email messages from Outlook, and then use Process email messages in Outlook when you save the email to mark it as read. Then, for each email address, you should retrieve email messages again, so you're only working with unread emails.

     

    Alternatively, you could use If file exists to check if the file already exists before saving it, and skip it if it does.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Atngocnguyen Profile Picture
    39 on at

    Hi

    Thanks for your support so far.

    However, I still have some issues with it:

    1. For your 1st solution, I found that Process email messages in Outlook  did not have function "Mark as read", just having function :" Mark as unread" --> So, I don't now how to work with it

    2. For your 2nd solution, I did as below, but it's not working (meaning many same emails were saved)

    Could you please help to check?

    Atngocnguyen_0-1691717252683.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You are missing a file name and extension in the If file exists condition. You are checking a folder only, while what you should be checking if %Folder%\%CurrentItem2['Vendor']%\{FileName}.msg

    I assume the file name is the subject text of the email message, so you might want to use that.

     

    For the first solution, you could then do the opposite of what I said - make Retrieve email messages from Outlook mark the retrieved emails as read, and then use Process email messages in Outlook mark them as unread if they are irrelevant for the current email address. If you keep retrieving emails for each email address, and only include unread messages, this could also work.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Atngocnguyen Profile Picture
    39 on at

    Thanks for your strong support as usually

    I tried 2 way, but still not yet fix the issue. Could you please help me to check?

    for 2nd solution, I fix as below, but it's not working T_T: 

    Atngocnguyen_0-1691728037215.png

    1st Solution, it's also not working. 

    Atngocnguyen_1-1691728592470.png

     

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    For solution #1, you should add an Else branch to your condition and move the Process email messages in Outlook to inside the Else branch. This way the email messages will only be marked as unread if the condition is not true. At this point with what you have done, they will always be marked as unread, regardless of the condition being true or false. And then you should also move the Retrieve email messages from Outlook action inside the first loop, so that it keeps retrieving messages each time it starts processing a new email address. This way the list of email messages will be refreshed, so you only process those that are unread.

     

    For solution #2, what exactly are you using as the file name? Can there be some special characters in there? You might want to use a custom file name - this would be easier to handle.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Atngocnguyen Profile Picture
    39 on at

    hi

    For 1st solution, I changed as your suggestion. It's work perfectly --> Thanks so much

    For 2nd solution: I used below code for File name. It means using the subject text of the email message
    So, I also move  the Retrieve email messages from Outlook action inside the first loop, it also work well

    Thanks so much

    Atngocnguyen_0-1691734449986.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 862

#2
Valantis Profile Picture

Valantis 738

#3
Haque Profile Picture

Haque 553

Last 30 days Overall leaderboard