Hot to get propetyInfo of Microsoft.Office.Interop.Outlook.MailIte

  • Thread starter Thread starter Jongmin
  • Start date Start date
J

Jongmin

Hi all,

I am trying to get propertyInfo of mailItem by the following codes.
However, there is no received properties.
myPropertyInfo's length is always zero.

Is there anybody who can give some information about this issue?

/* ========================================== */
Outlook.Application myApp = new Outlook.ApplicationClass();
Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Outlook.MAPIFolder myInbox
= mapiNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

Type t = typeof(Outlook.MailItem);
PropertyInfo[] myPropertyInfo = t.GetProperties();
foreach (PropertyInfo pInfo in myPropertyInfo)
this.lbxProperties.Items.Add(pInfo.Name);
 
That won't work with Outlook item properties at all, even if you use the
overload and specify binding flags.

What you should do is create a dummy mail item, get its ItemProperties
collection, and iterate that.
 
Back
Top