How To exclude Sender's Email from "Reply To All" Activity in Outlook?


I want to use “Reply To All” Activity in Outlook and exclude the sender’s email and keep the remaining contacts in “cc”, Possible in UiPath?

Thanks in Advance

1 Like

I don’t know whether this solves your issue or not @hsendel,

after reading the mail message, you will get the CC and BCC list as mail.CC and mail.BCC, (both are collections)

instead of that you can use send outlook activity and pass the variables above just by looping the above variables

1 Like

Thanks HareeshMR,

Could you please state the steps and activities needed for that ? Thanks in Advance

Here is the workflow, as it is complicated to explain, I’m just sending you the workflow but it is for reference, please try to replicate it in your workflow @hsendel

NewMailIDs.xaml (10.5 KB)

1 Like

Hi Again,

Thanks for Prompt Feedback. I use your workflow and I got the following Error Message:
Could you please help?

Hope these steps would help you resolve this
—use get outlook mail activity or another mail activity and get the output with a variable of type list of mailmessage named list_mailmessage
—Now use a for each loop activity and pass the above variable as input and in the property panel of for each loop activity mention as in the type argument property
—inside the loop use a assign activity and mention like this
List_mailmessagecc =
Where List_mailmessagecc is a variable of type MailAddressCollection (browse the type in the variable panel)
—still being inside the for each loop use another for each activity within that and mention the input as List_mailmessagecc,while change the variable name of for each loop from item to mailcc and inside the loop use a activity called ADD TO COLLECTIONS where in the collections property mention as list_cc where this is a variable defined in the variable panel of type system.collections.Generic.list(String) with default value as new List(of string) and in the item property mention as mailcc.Address
And in the type argument mention as string

Now all the cc recipients address of each mail will added to this list_mailcc variable

—still being inside the first for each loop with one more for each loop inside it, we need to now use SEND OUTLOOK MAIL ACTIVITY next to the inner for each loop(the one which adds the cc recipients

—in the send outlook mail activity mention the to as you or mention all the cc recipients mail address in the TO property as we won’t be able to send a mail without TO recipients so either we need to mention to person or cc person that you want to be sent with mail
And to mention cc recipients from that list variable list_mailcc use this expression in the TO property

And in the body we can what we want and in the subject same

—so this will fetch each mail from outlook
—iterate through each mail using for each loop
—get the cc recipients of each mail by using a for each loop with the above first for each loop
—next to this inner loop use send outlook mail activity to send mail to those cc recipients

Hope this would help you
Sorry for the log message I would have given you a xaml but on travel and not able to get to you with a xaml

You were almost done
Kindly try this and let know for any queries or clarification
Cheers @hsendel

1 Like

This Part is not Clear, You’re Talking about 2 For Each Loop :

Hi Again,
Still item setting has issue now:

I tried many option but still not able to define : mailcc.Address

By the way , any good reference for “Add To Collection” Activity? Thx

Hi Palaniyappan,

Thanks a lot for your Method, it’s very interesting, if possible share XAML file when possible. Meanwhile I have fixed the issue in simpler manner by using only : “ReplyToAll” Activity and stating only : string.Join(“;”,email.To) in “To” field :slight_smile:

1 Like

If there are no mails in the BCC list, then it will give the first error you posted and if you are not passing any mails ID to the send mail activity, it will give you the above error

I hope the one I shared has the variable with same name twice. Remove one of them and check

1 Like

Here is the workflow @hsendel

NewMailIDs.xaml (11.1 KB)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.