473,383 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Casting of Outlook items

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.MailItem CurrentMail = (Outlook.MailItem)FolderItemList[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 .....)
Sep 18 '08 #1
0 1242

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Anushya | last post by:
Hi How to get the id of a name in contact items in outlook. How to do it thru redemption in .net?? i tried the code below. but it shows the error. pls have a look at the code ...
4
by: Nathan Carroll | last post by:
Why am I able to use this in Outlook and not do the same from .Net. My problems centers around the Items in the xp version of below i used the interop references. Does something similar exist for...
7
by: Chris Thunell | last post by:
I'm trying to loop through an exchange public folder contact list, get some information out of each item, and then put it into a vb.net datatable. I run though the code and all works fine until i...
2
by: hsuntn | last post by:
I am grabbing Outlook MailItems using the Items property on my Outlook inbox. When I iterate through them, I notice that they are not ordered in ReceivedTime or CreationTime order. For example, ...
2
by: Snig | last post by:
Hi I'm into creating a web application in C# (.NET Framework 1.1) which would list and manage the outlook tasks. If I try to do this in a Windows Application, it works fine. But there are...
5
by: Arno R | last post by:
Hi all, I need to get at specific (shared) agenda-data from MS outlook 2003. I need every day to get the scheduled 'appointments' for some rooms to Access. In Access I will show the...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
0
by: thisisuniqueuserid | last post by:
throwing error " 'Outlook.Items' does not contain a definition for 'Item' " in asp.net while I added references for Interop.Outlook,Office still showing same error. If any body can help Thanks in...
4
by: rwm | last post by:
Hi Before updating to Access 2007 we could open outlook contact entries by using a hyperllink along the lines of <outlook://contacts etc> This does not seem to work in 2007 any more. We have a...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.