exception thrown by code stage: Specified cast is not valid

arun anto

New Member
Hello Team,

I am facing an issue while getting all emails from outlook inbox using Blue prism Outlook VBO. it runs without any issues most of the times. Sometimes it gives an error saying exception thrown by code stage: Specified cast is not valid. I tried using recovery by closing and launching outlook multiple times but with no luck. Any idea what could have caused the issue?

Any help would be much appreciated. Also, anyone tried using EWS for retrieving the emails from Inbox?
 

shakiratt

New Member
Hello Arun, am also having this issue, have you being able to solve it? If yes , pls kindly share your solution. Thank you
 

arun anto

New Member
Hi Shakiratt,
I have not able to find a full proof solution which works always. The logic which I have followed is to do a re-try multiple times and it works most of the times. However there are few types of mails which blueprism vbo code does not handle for eg: - outlook messages where sender email id is missing - these kinds of messages originated from outlook itself for eg:- giving a warning message as your mailbox is full, archive folder is almost full etc . if any such messages are there in your inbox, it will always fail irrespective of how many attempts you try. To handle it, you can put the code in try-catch block as shown below.
Try
row("SenderEmailAddress") = If (item.SenderEmailType = "EX",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)
Catch Ex as System.Exception
row("SenderEmailAddress") = "noSenderaddressfound@dummy.com"
End Try
 

shakiratt

New Member
Hi Arun, thanks for the response. i tried inserting the code but still it didn't work still bringing the same error, "Specified is not valid". Is there anything else you think i should try. Thanks
 
Top