For each email

Hi all

I have a list of emails to work through, saved as newEmail1, variable type System.Collection.Generic.List<System.Net.Mail.Message>. Until recently it was working, now I’m getting this error:

I’ve tried changing the TypeArgument but I’m still getting the same error - does anyone know why please?

Please note that I can’t use the For Each Email in the Use Desktop Outlook App as my work doesn’t allow the additional access required for it to work, so this is (I think) my only option

Thanks :slight_smile:

was it changed to: System.Net.MailMessage?

1 Like

Hi @Short

Can you try changing the typeArgument from Properties to System.Net.Mail.MailMessage.
Hoping that your variable newEmail1 is of MailMessage (Array of Mails)
that should help!

1 Like

Hi, @Short

Have You select type argument for For Each as System.Net.Mail.Mailmessage

1 Like


can you place the activity by replace it with the new activity again

so that the error we resolved sometimes catch will be present


1 Like

It was not haha, but it is now and it’s working, thank you so much!

One more thing though… when I run it on the VM, this comes up:


I have to click “Allow” and select either 1, 2, 5 or 10 minutes. Do you know how I would get rid of this please?

depending on some rights, maybe get helped by the IT Team:

Click in Outlook Files
Go to outlook Options
Click Trust center
Click trust center Settings
Macros , trust access to the VBA project object model i

Hey @ppr

Just checked and I don’t have the VBA project object model bit


I selected the “Enable all macros (not recommended)” bit but still had the same error

lets scope this topic to only one case (for each typeargument) as other researchers can easier find answers for their similar case.

For the second question, the hint is Trust Center and maybe interaction with your IT Team. You can try enable all … setting
And also check Programmatic Access setting - no warnings

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