Hi,
I am writing an application which (on user request) scans the Outlook inbox
for messages and other items which are relevant in the user defined context.
There are several code examples showing how to do that, but they all assume
that the Outlook inbox contains MailItems only. This is definitely not true,
I have identified - so far - some 18 item types which might also be found in
the Outlook inbox.
Here is my problem:
My application accesses Outlook and obtains a reference to the list of items
in the inbox. Getting the mail item is fairly straightforward :
Outlook.MailIte m CurrentMail = (Outlook.MailIt em)FolderItemLi st[iItem];
But this loop fails upon the first item which is not a mail item. The
appplication should be able also to filter appointments, meetings and a few
other item types.
How can I identify the type of item I am attempting to access so that my
application can branch to the code with the correct casting and further type
specific handling?
(A series of try-catch blocks, each one attempting to make another cast is
the only solution I have so far. But that is brut force .....)
I am writing an application which (on user request) scans the Outlook inbox
for messages and other items which are relevant in the user defined context.
There are several code examples showing how to do that, but they all assume
that the Outlook inbox contains MailItems only. This is definitely not true,
I have identified - so far - some 18 item types which might also be found in
the Outlook inbox.
Here is my problem:
My application accesses Outlook and obtains a reference to the list of items
in the inbox. Getting the mail item is fairly straightforward :
Outlook.MailIte m CurrentMail = (Outlook.MailIt em)FolderItemLi st[iItem];
But this loop fails upon the first item which is not a mail item. The
appplication should be able also to filter appointments, meetings and a few
other item types.
How can I identify the type of item I am attempting to access so that my
application can branch to the code with the correct casting and further type
specific handling?
(A series of try-catch blocks, each one attempting to make another cast is
the only solution I have so far. But that is brut force .....)