Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Last activity: 6 Nov 2018 20:02 EST
Outlook email retrieve errors
Hi, I'm exploring how to search email in Pega Robotic Automation Studio, but I'm stuck at the beginning step, please help. I have 1000+ unread emails in my Outlook Inbox, is there any impact due to this? I'm sure i have install the corresponding office version dll. i can use Outlook to send email in Pega..
Error information for your reference
Unable to cast COM object of type 'System.__ComObject' to event interface type 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event'. This operation failed because the QueryInterface call on the COM component for the interface with IID
please refer to the attachments for more details.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](https://accounts.pega.com/sites/default/files/pega-user-image/257/REG-257204.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/257/REG-257204.png?source=PUMINIT)
Pegasystems Inc.
US
I would recommend double checking that you have the right office version installed.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Hi grona,
I'm 100% sure that i have installed the right version. Because i can use outlook connector to send email in other automation. and i can also use excel connector.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Hi Grona,
please help on this. you can see Manish's testing result.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2024-05/1f77a272-b558-4261-964a-0a7d028c27c5.jpg?h=436c2321&itok=Ilx-4hBN)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2024-05/1f77a272-b558-4261-964a-0a7d028c27c5.jpg?h=436c2321&itok=Ilx-4hBN)
Pegasystems Inc.
US
I tried your exact automation and it works for me. In searching for that error message in Google I found this article - https://stackoverflow.com/questions/4656360/unable-to-cast-com-object-microsoft-outlook-c-sharp. This indicates that you might have encountered something other than a MailItem - I would put a Try .. Catch around the steps from your loop and see if it this happens all the time or only for specific items.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Thanks, Jeff. But in my automation, the error happens when go to email retrieve.
![](https://accounts.pega.com/sites/default/files/pega-user-image/209/REG-209263.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/209/REG-209263.png?source=PUMINIT)
Pegasystems Inc.
IN
Hi WoodYang,
While looking for assistance on your query with sme's, the best advise was to have you raise an SR to troubleshoot the issue.
Do let us know the SR-ID here once you create an SR. It helps in tracking.
Thanks!
-
Sre Parthiban Ravichandran
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
As of now, no available solution.
Finally i use C# code to search emails.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/f7151e69-7bd9-4702-be03-ebb6f0beb05f.jpg?itok=GWX3Wdig)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/f7151e69-7bd9-4702-be03-ebb6f0beb05f.jpg?itok=GWX3Wdig)
CollabPartnerz
IN
This helps you
https://stackoverflow.com/questions/4656360/unable-to-cast-com-object-microsoft-outlook-c-sharp
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
I have tried to get the count of the e-mails in a folder using method RetrieveEmail of MS Outlook Connector and getting the same error discussed above (Unable to cast COM object)
Below are the steps followed
Step 1: Success
Folder: Draft (Low in Volume and no sub-folders present)
Read Type: Unread
O/P: Count of emails retrieved
Step 2: Failure
Folder: Inbox(High in Volume and various sub-folders present)
Read Type: Unread
O/P: Error received(Unable to cast COM object)
Step 3: Failure
Folder: Draft (Low in Volume and no sub-folders present)
Read Type: All
O/P: Same error encountered
Deleted the RetrieveEmail automation block and applied the new automation block in same manner.
Step 4: Success
Folder: Draft (Low in Volume and no sub-folders present)
Read Type: All
O/P: Count of e-mail retrieved
For Inbox it is giving error consistently. Is it related to volume of the email present. However, I have tried with 2-3 sub-folders of Inbox as well which has low volume but still giving same error.
Automation code for each step is in attachment. Please suggest how to solve this error.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Hi Manish,
Which version are you using. I'm using 1084 and 1087, my issue is still not resolved.
But i have coded a C# script for instead this component.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
I am using 1084
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Flextronics Technology Co Ltd
CN
Anyone can help on this issue? Not only myself, but also others such as Manish above encounter the same issue.
![](https://accounts.pega.com/sites/default/files/pega-user-image/257/REG-257204.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/257/REG-257204.png?source=PUMINIT)
Pegasystems Inc.
US
This needs an SR.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-07/f7f35052-5e7d-4ed9-ada9-87594f1d3c63.png?itok=bz3Ms_gZ)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-07/f7f35052-5e7d-4ed9-ada9-87594f1d3c63.png?itok=bz3Ms_gZ)
Pegasystems Inc.
US