The above said task seems so simple as per this stack overflow question or this MSDN How To.
But I am just struck at the line foreach (Outlook.MailItem mail in items)
, where I get an exception saying "Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.MailItem' ...".
Though there are quite a few posts about this exception, none could help me in getting over it.
Can someone please help me to solve this and to be able to read the emails from C#.
Thanks