Question

2
Replies
681
Views
AndrewS4727 Member since 2018 1 post
Nationwide Building Society
Posted: 1 year ago
Last activity: 1 year 2 months ago
Closed

Outlook - Interop.Outlook.Items to OpenSpan.Office.MicrosoftOutlookMailCollection failure

Hello all,

Overview of issue:

I'm hoping someone can assist me with an issue I'm having trying to access Shared (secondary) mailboxes.

I've been trying to write a C# script that can return all mail secondary mailboxes folder. Following the advice from the below page

https://community1.pega.com/community/pega-support/question/listening-sharedgroup-mail-box-outlook

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.

Detailed error:

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?

Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn