I am currently trying to read certain properties of Outlook Contact objects through an API managed by Microsoft EWS. I am extracting these Contact objects from a function FindItems(). Some of these fields are advanced properties, such as Titleor User1, and I find it difficult to read. At the moment I have:
Guid propertySetId = new Guid("{00062004-0000-0000-C000-000000000046}");
ExtendedPropertyDefinition titleProp = new ExtendedPropertyDefinition(propertySetId, 0x3A45, MapiPropertyType.String);
ExtendedPropertyDefinition user1Prop = new ExtendedPropertyDefinition(propertySetId, 0x804F, MapiPropertyType.String);
string title, user1;
contact.TryGetProperty(titleProp, out title);
contact.TryGetProperty(user1Prop, out user1);
When executed, it TryGetPropertyalways returns false. I have verified that these fields are populated in Outlook for the contacts I'm looking for.
Edit: this is how I retrieve contact objects.
ExchangeService service =
Mailbox userMailbox = new Mailbox(emailAddress);
FolderId folderId = new FolderId(WellKnownFolderName.Contacts, userMailbox);
FindItemsResults<Item> results;
const string AQS = "Category:~>\"CategoryTag\"";
ItemView view = new ItemView(200);
results = service.FindItems(folderId, AQS, view);
foreach (var result in results)
{
Contact contact = result as Contact;
}
source
share