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 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,255 Moderator 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

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 250 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 180

#3
Haque Profile Picture

Haque 159

Last 30 days Overall leaderboard