Attachment is ambiguous

Hi Team,

This use case was developed before to send emails using Send Outlook Mail Message activity .

I am trying to change from Send Outlook Mail Message activity to Send Exchange Mail Message.

As soon as i added Send Exchange Mail Message or after updating the UiPath.Mail.Activities. Getting below error.

Kindly suggest on this error

Two different references have an Attachment method so it doesn’t know which you are trying to use. You have to be specific.

Change Attachment(path.ToString) to System.Net.Mail.Attachment(path.ToString) or Microsoft.Exchange.WebServices.Data.Attachment(path.ToString) - I’m not sure the differences between the two or which will work for you.

By the way, I highly recommend using Send SMTP Mail Message. It’s much simpler and more reliable than going through Outlook or Exchange.

Hey @Sathish_Kumar_S

It is due to the missing namespace, just add New System.Net.Mail.Attachment(path.ToString)

Thanks
#nK

May i know the name of the namespace to import?

Hey @Sathish_Kumar_S

I guess it should be already imported.

Kindly add this in your statement System.Net.Mail

Thanks
#nK

yes it was already imported

Getting below after i have updated System.Net.Mail.Attachment(path.ToString)

Hey @Sathish_Kumar_S

Add new keyword as well please before that.

Thanks
#nK

Thanks a lot .. it worked

Cool :+1::slightly_smiling_face: @Sathish_Kumar_S