cancel
Showing results for 
Search instead for 
Did you mean: 

Error -Specified Cast Not Valid while Retrieving mails - Outlook VBO

ArunAnto
Level 2
Hello Team, I am facing an issue with Outlook VBO internal Business object - Basic Get Mails action. I am trying to read all emails from Inbox both Unread & Unread emails. Once in every 10 runs , we get an error "Specified Cast not Valid". After attempting run mutiple times on the same set of mails, it works. I have checked event logs but it does not show anything unusual. Any idea what is causing this issue ? Any help in this regard is much appreciated.      
4 REPLIES 4

John__Carter
Staff
Staff
Maybe temporarily enable logging in the VBo to see where the failure point is? Or could it be 1 mail in particular that is causing the issue? In the VBO on the 'Internal_Get Items' page you'll see the code stage that retrieves mail. In it you'll see a series of lines where it populates a row in the datatable (collection) output, eg row("Subject") = item.Subject I'm wondering if the cast error comes from one of these lines? And maybe by commenting out these lines one at a time and re-running the test, you'll locate the problem?

ArunAnto
Level 2
Hi John,   Thanks for the response . I did go through the code stage and removed unwanted attributes of the item .as i initally felt the same .For eg: attachment etc . However  I was bit confused since if i try mutliple times , it works for the same set of mails.

John__Carter
Staff
Staff
Hmm strange. If it can work sometimes and sometimes not, could it be that Outlook is 'doing something' at the time of the exception? Not sure what to suggest to be honest, other than to keep experimenting to bear down on the problem.

JanSkarbek
Level 3

Hi, I just had the same situation and it turned out that it has been caused by some recalled messaged in an inbox. Once I removed this recalled message (as it's not really a message but some other type of Outlook item), the 'List Emails' action started working again.