Hi
We can use reflection as below.
The item's Class property will be one of the enum type Outlook.OlItemType.
private void button1_Click(object sender, System.EventArgs e)
{
Outlook.Application olApp = new Outlook.ApplicationClass();
Outlook.MAPIFolder mi =
olApp.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolde
rInbox);
foreach (Outlook.MAPIFolder o in mi.Folders )
{
if (o.Name=="test" )
{
mi = o;
break;
}
}
foreach(object o in mi.Items)
{
Outlook.OlItemType oo
=(Outlook.OlItemType)o.GetType().InvokeMember("Class",System.Reflection.Bind
ingFlags.GetProperty,null,o,new object[]{});
Console.WriteLine(oo.ToString());
}
}
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.