Hello Team, I want to know it’s possible to convert uipath Office365Message object to MailMessage object? Because i need to change the process code which is related to Microsoft Office 365.
@soneill437
Hello,
Can you try a simple CType(yourVar, MailMessage) ?
It seems that Office365Message object is a child of MailMessage so it must be possible to cast but you’ill lose informations i think (i don’t know which however)
Hello @Yamatendo,
I tried as you suggested but it’s not working.
var Office365GetMail type= UiPath.MicrosoftOffice365.Models.Office365Message
var out_ListMailMessages type= System.Collections.Generic.List[System.Net.Mail.MailMessage]
Error Screenshot:
Didn’t you invert the var and the type in your CType ? ^^
Hello @Yoichi,
Actually i need to change the process code which was build with Get Exchange Mail Messages to get the email from inbox & process next steps. But currently we are going to use Microsoft Office 365 Scope activity to get the email from inbox. So you suggest me how to convert uipath Office365Message object to MailMessage object?
Can you explain with example?
You did this : CType(Office365GetMail, out_ListMailMesssage)
I think what you have to do is as follows:
Assign: yourListOfMailMessage = New List(of MailMessage)
for each item in out_ListMailMessage (use for each instead of for each mail)
add to collection (set the type to mailmessage) → List = yourListOfMailMessage, Var = CType(item, MailMesage)
End of for each
Use the System.Net.MailMessage and NOT System.WEB.MailMessage
Hello Team,
Please use this code in assign activity to convert Uipath office365message object to Mail message object.
out_ListMailMessages=var_ListOfficeMailMessages.OfType(Of System.Net.Mail.MailMessage ).Cast(Of System.Net.Mail.MailMessage).toList
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.