Problem with add multiple attachments

Hi everyone,

I have a problem, when i try to add various files to the attachment, when i use assign:

attachment = new Attachment(item,System.Net.Mime.MediaTypeNames.Application.Octet)

appear the next error: ‘Attachment’ is ambiguous, imported from the namespace or types ‘Microsoft.Exchange.WebServices.Data, System.Net.Mail’

Can someone help me?

Thanks !

Hi.

Try using a different variable name on the left side for attachment, because Attachment is part of the namespace System.Net.Mail, which you are using on the right side.

Hope that solves it.

Regards.

Looks like OP has both Microsoft.Exchange.WebServices.Data & System.Net.Mail namespaces imported in his project there by causing the conflict with attachment.

Try using fully qualified namespace:

attachment = new System.Net.Mail.Attachment(item,System.Net.Mime.MediaTypeNames.Application.Octet)

6 Likes

Thats work, thanks !

1 Like

Happy Automation !

1 Like

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