How to initialize Office365Message?

How to initialize Office365Message like wise for MailMessage as New System.Net.Mail.MailMessage

Hello,

You can just cast Office365Message in MailMessage (if it’s the question)

Hi @Yamatendo

I tried CType(New System.Net.Mail.MailMessage, Office365Message) but getting below error.
Assign: Unable to cast object of type ‘System.Net.Mail.MailMessage’ to type ‘UiPath.MicrosoftOffice365.Models.Office365Message’.

What you need to do is to have your variable of type Office365Message and then convert it as follow : CType(myVar, MailMessage)

But CType(myVar, MailMessage) will convert Office365Message to MailMessage right?
I need conversion from Mail Message to Office365Message and initialization of Office365Message

Oh ok sorry…
Office365Message is herited from MailMessage so maybe you can contruct an office365message object

image
When I’m trying to initialize, I’m getting this error. Any solution for this

Hi @balaji123156

This is how you initialize it

New UiPath.MicrosoftOffice365.Models.Office365Message

Hope this helps

cheers

Hi @Anil_G
image
Still getting similar error

HI @balaji123156

You can add microsoft.Graph to the imports

Ideally even after adding this you might get new is not a member as there is no initializing exposed

May I know why you want to intialize it separately?

Ideally as this is a UIPath custom class it gets initialized when it is called

Is there any specific requirement to initialize it?

cheers

Upgrading Exchange mail activities to Office 365, there I came across an assign activity initializing New System.Net.Mail.MailMessage

Hi @balaji123156

You don’t need it here. In there when mails are not there it would be nothing i guess here you will still get a count

or alternately you can check with Isnothing(offcie365mail) to find if it is empty

But ideally you should get the variable initalized once it is used in any of the activities

cheers