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 Automate
Answered

outlook actions

(1) ShareShare
ReportReport
Posted on by

Hello,

 

I created a process that saves email attachments to a network folder and moves email to archive folder.  It's currently looking for unread emails, from a specific sender, and subject line test.

 

Current process:

launch outlook \\ retrieve email messages from Outlook \\ Process email messages in Outlook  \\ Close outlook

 

Can someone help me add a file name and file type extension logic to the process?  So look for file name = Audit and file extension = .xlsx

 

Any help or direction would be greatly appreciated.

 

Thanks,

 

Tim

 

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @Maverick79 

    You  can apply filter condition based on subject line but You cannot directly filter attachments in Outlook. However, once all attachments are saved, you can use the "Get files from folder" action to list all files in the attachment folder. You can then apply filters based on file names and extensions, and delete any files that do not meet the criteria.

     

    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Verified answer
    NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @Maverick79 !

     

    Try this flow:

    NathanAlvares24_0-1719861187164.png

     

    Input:

    NathanAlvares24_2-1719861564841.png

    NathanAlvares24_3-1719861580107.png

     

     

    Output:

    NathanAlvares24_1-1719861490105.png

    After sometime it will appear in the Archive folder.

    NathanAlvares24_4-1719861650093.png

     

    Code (just copy-paste into your flow)(Please put the necessary paths of your folder like Network folder. I just added folder name as 'Network'):

    Outlook.Launch Instance=> OutlookInstance
    Outlook.RetrieveEmailMessages.RetrieveEmailsAndSaveAttachments Instance: OutlookInstance Account: $'''nathanlalvares@hotmail.com''' MailFolder: $'''Inbox''' EmailsToRetrieve: Outlook.RetrieveMessagesMode.Unread MarkAsRead: False ReadBodyAsHtml: False FromContains: $'''username@hotmail.com''' SubjectContains: $'''test''' SaveAttachmentsInto: $'''C:\\Users\\UserName\\Desktop\\Network''' Messages=> RetrievedEmails
    LOOP FOREACH RetrievedEmail IN RetrievedEmails
     LOOP FOREACH Attachment IN RetrievedEmail.Attachments
     IF (Attachment.NameWithoutExtension = 'Audit' AND Attachment.Extension = '.xlsx') = $'''True''' THEN
     Outlook.ProcessEmailMessages.MoveEmails Instance: OutlookInstance Account: $'''username@hotmail.com''' EmailsToProcess: RetrievedEmail MailFolder: $'''Archieve'''
     ELSE
     File.Delete Files: Attachment
     END
     END
    END
    Outlook.Close Instance: OutlookInstance

     

    I hope this helps.

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard