I have the following class, which is designed to return the subject line of all letters in a folder
This is Visual Studio 2008 vs Outlook 2007, running on Windows 7 64bit
using System; using System.Windows; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Interop.Outlook; namespace MarketingEmails { public class MailUtils { public static string[] processMailMessages(object outlookFolder)
}
However, the code throws an exception below:
Cannot pass a COM object of type "System .__ ComObject" to the interface type "Microsoft.Office.Interop.Outlook.MailItem". This operation failed because the call to QueryInterface on the COM component for the interface with IID '{00063034-0000-0000-C000-000000000046} failed due to the following error: this interface is not supported (exception from HRESULT: 0x80004002 (E_NOINTERFACE) )
I understand that an error has occurred because it is trying to process the ReportItem in the selected mailbox.
What I donβt understand is why Iβm trying to execute the process of processing non-Mail items when I pointed out:
foreach (MailItem oItem in theMailFolder.Items)
If I wanted him to process the entries in the entries in the mailbox, I would write:
foreach (ReportItem oItem in theMailFolder.Items)
I would love to know if this is a mistake or is it just my misunderstanding
Regards, Nigel Ainsko
c # visual-studio-2008 outlook
Nigel ainscoe
source share