How to add an mailmessage to MailMessage array

Hi guys,

I am trying to add a MailMessage to an array of MailMessage but I get an error.
So my question is how can I add a mail message to an array?

@CVGenderingen

Could you please tell more details for better understanding.

As per my understanding, you used Get Outlook Mail activity and read mails from outlook and it will give you list as output. Then use For each loop activity to iterate that list of mail messages and then use Add to collection activity. For this you need to create one variable of type collection before adding.

Yes I used Get Outlook Mail to get all the unread emails then I user the For Each loop to go through each email. Then I used an if statement to get only the emails from a specific sender but now I want to add them to an array. I now have an Assign to assign my arrEmail(Count) = Email.

@CVGenderingen

You are trying to add senders mail id’s to collections right ?

I am trying to add the item from the for each loop as email to add

What are you trying to achieve after getting the mails to array?

I want to use the array in another sequence

@CVGenderingen

Please find the attached workflow for your reference.

AddMails.xaml (9.2 KB)

If you are trying to get mails sent from a specific user, you can get the list directly by providing filter condition in Get Outlook Mail activity.

If you want to use it as such, instead of array, create a collection of type mail message.

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