简体   繁体   中英

Access custom view column from exchange public folder

I'm using Exchange Web Services to access contact records in a public folder. I need to pull a custom column, "Client Contact Management", created for a view in that folder. The custom column was created in the user interface.

I've already used the ExtendedPropertyDefinition class before on properties that I have created on my own through code. Is that what I'm supposed to use in this case and if so then how do I get the guid for the custom column?

在此处输入图片说明

I finally found the answer on this thread from David Sterling on the microsoft exchange server forums. His example (copied below) shows how to do things using EWS directly and using the managed api.

// via autogenerated proxy classes

PathToExtendedFieldType hairColorPath = new PathToExtendedFieldType();
hairColorPath.DistinguishedPropertySetId = DistinguishedPropertySetType.PublicStrings;
hairColorPath.DistinguishedPropertySetIdSpecified = true;
hairColorPath.PropertyName = "HairColor";
hairColorPath.PropertyType = MapiPropertyTypeType.String;

// via the Client API

ExtendedPropertyDefinition hairColor = new ExtendedPropertyDefinition(
      DefaultExtendedPropertySet.PublicStrings, 
      "HairColor", 
      MapiPropertyType.String);

Here is what I did using the managed api for my own problem. The key is using the DefaultExtendedPropertySet.PublicStrings which is where outlook stores the custom view column.

ExtendedPropertyDefinition _clientContactManagementPropertyDefinition =
     new ExtendedPropertyDefinition(
          DefaultExtendedPropertySet.PublicStrings, 
          "Client Contact Management", 
          MapiPropertyType.Boolean
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM