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 / Flow Creation - Saving...
Power Automate
Unanswered

Flow Creation - Saving e-mails and attachments between Outlook and Onedrive based on MATCH

(0) ShareShare
ReportReport
Posted on by

Hello! I currently receive Outlook e-mails, drag and save into their respective folders on our OneDrive and then manually rename them.

 

Would it be possible to have Power Automate match part of the e-mail subject to the OneDrive destination folder name and then save the e-mail and attachments in said folder? If a match fails, it would not process.

 

The e-mail subjects have the client name a majority of the time, but also contain strings of unrelated words. For example:

 

Outlook E-mail Subject: Bound Confirmation: Quote Attached: (EXTERNAL) Microsoft Corporation Inc. - Assigned Broker

OneDrive Folder: Microsoft Corporation, Inc.

I have the same question (0)
  • NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @AutomatedWork !

     

    I would like some more information on this part.


    The e-mail subjects have the client name a majority of the time, but also contain strings of unrelated words.


    1. Does it always appear like this:

    Bound Confirmation: Quote Attached: (EXTERNAL) Microsoft Corporation Inc. - Assigned Broker

     

    2. Do all the emails have the subject with keywords like "Bound Confirmation" or "Quote Attached" or "Assigned Broker"?

     

    3. Can you suggest some more examples? Based on that, we can create regex patterns to extract the client name from the subject.

     

    Would love this information to provide you a flow.

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @AutomatedWork ,

     

    Please find the solution.

     

    VishnuReddy1997_0-1719249005836.png

    VishnuReddy1997_1-1719249064348.png

     

    Code:

    Outlook.Launch Instance=> OutlookInstance
    Outlook.RetrieveEmailMessages.RetrieveEmails Instance: OutlookInstance Account: $'''vishnuvardhan.reddy@c.com''' MailFolder: $'''Inbox''' EmailsToRetrieve: Outlook.RetrieveMessagesMode.Unread MarkAsRead: False ReadBodyAsHtml: False BodyContains: $'''Sample''' Messages=> RetrievedEmails
    LOOP FOREACH CurrentItem IN RetrievedEmails
     SWITCH RetrievedEmails[0].Subject
     CASE Contains($'''Microsoft''', True)
     Outlook.RetrieveEmailMessages.RetrieveEmailsAndSaveAttachments Instance: OutlookInstance Account: $'''vishnuvardhan.reddy@c.com''' MailFolder: $'''Inbox''' EmailsToRetrieve: Outlook.RetrieveMessagesMode.Unread MarkAsRead: True ReadBodyAsHtml: False BodyContains: $'''Sample''' SubjectContains: $'''Microsoft''' SaveAttachmentsInto: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Outlook\\Outlook\\Microsoft''' Messages=> RetrievedEmails
     Outlook.SaveOutlookEmailMessages.SaveEmails Instance: OutlookInstance Account: $'''Varikutivishnuvardhan.reddy@cyient.com''' EmailsToSave: CurrentItem SaveFormat: Outlook.MessageType.OutlookMessageFormatUnicode SaveEmailsTo: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Outlook\\Outlook\\Microsoft''' MessagesFiles=> StoredMessagesFiles
     CASE Contains($'''IBM''', True)
     Outlook.RetrieveEmailMessages.RetrieveEmailsAndSaveAttachments Instance: OutlookInstance Account: $'''vishnuvardhan.reddy@c.com''' MailFolder: $'''Inbox''' EmailsToRetrieve: Outlook.RetrieveMessagesMode.Unread MarkAsRead: True ReadBodyAsHtml: False BodyContains: $'''Sample''' SubjectContains: $'''IBM''' SaveAttachmentsInto: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Outlook\\Outlook\\IBM''' Messages=> RetrievedEmails
     Outlook.SaveOutlookEmailMessages.SaveEmails Instance: OutlookInstance Account: $'''vishnuvardhan.reddy@ct.com''' EmailsToSave: CurrentItem SaveFormat: Outlook.MessageType.OutlookMessageFormatUnicode SaveEmailsTo: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Outlook\\Outlook\\IBM''' MessagesFiles=> StoredMessagesFiles
     END
    END

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard