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

1 Like

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.

1 Like

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

1 Like

May i know the name of the namespace to import?

1 Like

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)

1 Like

Hey @Sathish_Kumar_S

Add new keyword as well please before that.

Thanks
#nK

1 Like

Thanks a lot … it worked

1 Like

Cool :+1::slightly_smiling_face: @Sathish_Kumar_S

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