I have created a script (see attached) that successfully gets the items, but I cannot convert from 'Microsoft.Office.Interop.Outlook.ItemsClass' to 'OpenSpan.Office.MicrosoftOutlookMailCollection'
I wish to use the Collection method, so I can use the in-built proxy methods, rather than having to write out my own versions.
When I try to run this script, I'm presented with the below error:
Error executing link in Automation: Automation1 - From: Automation1.variable5.Properties To: Automation1.script1.AccessAlternateMail()
Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ItemsClass' to class type 'OpenSpan.Office.MicrosoftOutlookMailCollection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Attempts to resolve thus far:
I'm very new to C# coding but have tried using Marshal to help convert the data, but there isn't a Marshal for OpenSpan.
I've been searching the forums for a few hours but can't see any other posts on this, nor can I find a guide on how OpenSpan.Office.MicrosoftOutlookMailCollection works, so I can't see how to write my own converter.
For reference, I've also attached a screenshot of how I'm trying to use it in my automation.
Apologies if this is a duplicate, but can someone offer any assistance in completing the above conversion?
This morning, I tried amending the script to give me an individual mail from Microsoft.Office.Interop.Outlook.Items and converting this to OpenSpan.Office.MicrosoftOutlookMail however this has yielded the same type conversion error.
I would really appreciate some help with this, I'm happy to write this solution myself, if someone can point to a source for how OpenSpan.Office.MicrosoftOutlookMail or OpenSpan.Office.MicrosoftOutlookMailCollections works.