How to download attachments from a specific outlook mail

Can someone send a sample .xaml file for downloading attachments from a specific mail in outlook. Appreciate the help.
Thanks :slight_smile:

1 Like


  1. Use Get Outlook MailMessage Activity to read mails from outlook. If you want to read specific mails then pass subject into filter option like below and will give output as List of Mail Messages and name it as mailMessage

"[Subject] = ‘Subject of the Mail’ "

  1. Then use For Each loop to itreate that list of mails.

ForEach item in mailMessage
- use Save Attachments Activity to
save the attachments

Hi buddy
Kindly follow the below steps that could help you resolve this
–use any get outlook mail Activity, but make sure that your system is configures with outlook or we can use get exchange mail activity and here we need to mention the user credentials and server name as well
–in the filter property, we can specify the criteria to be specified like what to be obtained from the inbox… like this
"[Subject] = ‘the mail subject you want to search for’ "
–the output of this get outlook mail will be of type collection of mailmessages and lets name it out_mailmessage
–Now use a for each loop and pass the above as input and make sure that the tyoe argument property in the for each loop is changed to mailmessage
–inside this loop use a Activity called Save attachement, inside which pass the input with mail input as item, the Variable that we obtain from for each loop and in file path mention the path where you want to save the file with file name you want to save with

Thats all buddy you are done
Kindly try this and let know for any queries or clarification
Cheers @Juni2799

What is the filter for Sender’s address and what do you mean by configure the system with outlook??
Also, thanks for the prompt replies :slight_smile:

vMailMessageVariable.From.ToString will give you the senders name where vMailMessage variable is the mail object

Hi @chdas, thanks for the reply but can you please give a step by step how-to for it…Thanks

Fine i meant this like your system is installed with outlook or not…if make sure to install outlook if we are using get outlook mail activity, as unless we have that installed we cannot perform this activity

Then for Sender’s Address filter
we can handle this two methods

  1. First we need to use like this filter property in get outlook mail activity
    "[From]=‘Abisha Gopalan’ ”
    (not the mail id with domain details, just name)
    But if we want to filter gmail mail address from my outlook, we need to mention like this
    "[SenderEmailAddress]=,abisha****’ "**


  1. If we dont know the name part to be mentioned in Filter property of get outlook mail
    avoid mentioning the filter and we can make some filter once after getting the mail list from the get outlook mail activity with a if condition like this
    –get the output from get outlook mail activity with a variable of type mail messages collection named out_mailmessage
    –use a for each loop and pass the above variable as input and change the type argument as mailmessage in for each loop property
    –inside the for each loop use a if condition to validate with sender name
    like this
    item.From.Tostring.Equals(“Your person’s mail id”)

Hope this would help you
Kindly try and let know for any queries,
and make a tag with @ followed by name as then only we will be getting the notification
Cheers @Juni2799

Check the below workflow to get the sender and follow the steps

  1. Properties for Get outlook mail messeges
    MailFolder = “Inbox”
    Account = (Outlook should be installed in the machine)
    You have options to choose between read and unread emails
    Output - Provide a variable Say vEmailMessages

  2. For Each Activity
    TypeArgument = System.Net.Mail.MailMessage
    Values = vMailMessages

Inside For Each put a log with vMailMessages.From.ToString.


Hi @Palaniyappan I used the 2nd method you wrote and in the If condition I used the save attachments activity but it doesn’t download the attachments nor does it make the folder with the name provided. Thanks for the reply

Can i have a view on the workflow a screenshot if possible
Cheers @Juni2799

Here’s the screenshot.

usually mail id wont have space inbetween like this
is the mentioned string is correct
if we are not sure with the full email id, we can mention a part of it with this condition
item.From.Tostring.Contains(“a word from the mail id”)
Cheers @Juni2799

No, Hidden Email in the sense I didn’t want to show the email ID of the person that’s why I wrote like that. Otherwise I write like this -

so is that variable…!
if so remove the double quotes around and just mention like item.From.ToString.Equals(Hidden Email)
Cheers @Juni2799

It’s not a variable, the actual email ID is confidential content that’s why I have written “Hidden Email” so that the email doesn’t show on the screenshot. I have understood what you told me but I’m trying to say that it’s not working nor is it showing any errors.
Also the attachments are not been downloaded, it just executes and closes without downloading the attachments.

what does this means,
is it a mail id or what,OR
does this string comes inside the mail id,
see this item.From.Tostring.Contains(“a word from the mail id”) will usually check whether the mailid has the word that is mentioned within the double quotes
Cheers @Juni2799

Getting this error now.