I'm trying to enumerate the properties of an Microsoft.Office.Interop.Outlook.ContactItem object (let's call it ci) with this code:
System.Reflection.BindingFlags bf = System.Reflection.BindingFlags.Default;
foreach (System.Reflection.PropertyInfo pi in ci.GetType().GetProperties(bf))
{
Console.WriteLine("Property Info {0}", pi.Name);
}
I've actually tried several combinations of BindingFlag values, but no properties are ever returned.
This is how ContactItem is defined:
using System.Runtime.InteropServices;
namespace Microsoft.Office.Interop.Outlook
{
[Guid("00063021-0000-0000-C000-000000000046")]
[CoClass(typeof(ContactItemClass))]
public interface ContactItem : _ContactItem, ItemEvents_10_Event
{
}
}
This is how _ContactItem is defined (I've kept only 3 props for simplicity):
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Office.Interop.Outlook
{
[TypeLibType(4160)]
[Guid("00063021-0000-0000-C000-000000000046")]
public interface _ContactItem
{
[DispId(14848)]
string Account { get; set; }
[DispId(63511)]
Actions Actions { get; }
[DispId(14913)]
DateTime Anniversary { get; set; }
}
}
Could somebody help me?
Thanks in advance
Bob
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…