How to Cast during Assign Object ->


I am using _Application.CreateItem(0) method to create new mail item resulting Object type - i am not able to assign this created item to mailItem variable.

Please see my workflow and give me advice how to cast my Object to Mailitem. (I need to invoke Display method afterwards, therefore i need to store mailitem in specific object type.Main.xaml (5.4 KB)



in company policy, we cannot invoke Code in RPA

VB.NET code as follows works fine in invoke code

Dim outApp As New Microsoft.Office.Interop.Outlook.ApplicationClass
Dim outMailItm As Microsoft.Office.Interop.Outlook.MailItem = CType(outApp.CreateItem(0), Microsoft.Office.Interop.Outlook.MailItem)
outMailItm.SentOnBehalfOfName = “test”

Main.xaml (5.1 KB)

How can i rewrite this simple code into sequence of Assign acitvities and Invoke Method activities please? There is some problem in importing namespaces it seems.