Specified cast is not valid when reading Outlook Mail

I have been running a robot for some time and now when using the get mail activity I’m getting an error “Specified cast is not valid.” when looking in the logs it simply says that the activity had faulted. I have reset the variables (using the ctl-k trick) but still, have the issue.

Is there a way to see why this is faulting? To be able to debug inside the activity in any way ?
normally I would have this error for an invalid type being passed? How can I check to ensure the type being passed back has not changed?

1 Like


could you attached your xaml file?

@irahmat thanks. I have been doing some digging on this and it’s not an issue with the XAML at all. Outlook had not been closed for a long time. I rebooted the box and as such also rebooted outlook and the issues was resolved. Don’t know how I can find the root cause from that.

When running and getting the cast error (on repeated runs) the mail would be flagged as read but then fail to pass the data back. Not sure if there was a COM patch to windows that meant a reboot was required. I’ll have to see if this comes up again !