Getting value of Hobby field using Exchange EWS RRS feed

  • Question

  • Hi,

    I am using EWS excahnge API with axis and accessing Exchange_2007_SP1 server.

    In a standard outlook contact there are 4 fields with the names User Field 1 ....4.
    We can update and access those fields using extended properties.

    We also want to get the value of Hobby field.  As this field is not exposed in the EWS api,   We tried the same way of extended property as we did for user fields.  but its not working.  When We add the the value of hobby, it goes as an extended property but it is not shown on the outlook.

    We have given the propertyId of this as - 14915 (which we got from outlookspy)

    Here is the code snipet

    ExchangeServiceBindingStub mEWSservice;

    // List to hold extended properties of the contact - in our case User1 and Hobbies
    ArrayList<ExtendedPropertyType> listExtendedProperty = new ArrayList<ExtendedPropertyType>();

    // Create a contact object
    ContactItemType contact = new ContactItemType();


    // Set value of User1 field

    PathToExtendedFieldType extendedFieldURI = new PathToExtendedFieldType();
    ExtendedPropertyType extendedProperty = new ExtendedPropertyType();
    extendedProperty.setValue("Value for User1");

    // Set value of Hobby field
    PathToExtendedFieldType extendedFieldURI = new PathToExtendedFieldType();
    ExtendedPropertyType extendedProperty = new ExtendedPropertyType();

    contact.setExtendedProperty(listExtendedProperty.toArray(new ExtendedPropertyType[listExtendedProperty.size()]));
    ContactItemType[] contacts = listContacts.toArray(new ContactItemType[listContacts.size()]);

    // Build CreateItemType and set the Contact
    CreateItemType createItemrequest = new CreateItemType();
    DistinguishedFolderIdType distinguishedFolder = new DistinguishedFolderIdType();
    NonEmptyArrayOfAllItemsType arrayItems = new NonEmptyArrayOfAllItemsType();
    TargetFolderIdType folderIdType = new TargetFolderIdType();
    CreateItemResponseTypeHolder createItemResponse = new CreateItemResponseTypeHolder();
    ServerVersionInfoHolder exchangeServerVersion = new ServerVersionInfoHolder();

    mEWSservice.createItem(createItemrequest, null, null, null, requestVersion, createItemResponse, exchangeServerVersion);


    On executing this code, the contact gets created and in outlook we can see the displayname and user1 field values.  But we don't see the value of the Hobby field in outlook.

    Lateron when we retrieve the Hobby field using EWS API, we get the value of Hobby property that was set during add operation.So the problem that we face is that  the Hobby field that we  set during add operation is not displayed in Outlook.

    Can anyone help me on this.

    Thank you.

    - Regards

    - Bhagya

    Monday, March 28, 2011 2:31 PM

All replies

  • Extended properties you add via EWS wont appear in the Outlook fields chooser if you have a read of David's response in it explains the reason why further on in the thread there are some suggested workarounds for this.


    Tuesday, March 29, 2011 2:18 AM
  • Hi Glen,

    Thanks for your reply but unfortunately it does not seem to answer my question.  Let me simplify my question.

    Using Outlook, we give value to Hobby field.  Now we want to retrieve it using EWS api.  As there is no direct method to access this field we tried to access it as extended property.  but no sucess.  Whereas the same works fine for user1, user2, user3, user4 fields.

    Also we are facing the problem vice-versa(adding from EWS api and not able to see its value in outlook)

    Please help us on the same.

    Thank you.



    Tuesday, March 29, 2011 4:57 AM
  • Okay it sounds like you don't quite understand the difference between named properties and a tagged property firstly have a read of . The hobbies property is a tagged property so you would define this as

    PathToExtendedFieldType hobbies = new PathToExtendedFieldType();
    hobbies.PropertyTag = "0x3A43";
    hobbies.PropertyType = MapiPropertyTypeType.String;



    Tuesday, March 29, 2011 6:07 AM
  • Hi Glen,

    Thanks again.

    We changed the code as per your suggestion and set the PropertyTag instead of propertyId.  But on execution, we got an exception.

    The code snipet is -

    PathToExtendedFieldType extendedFieldURI = new PathToExtendedFieldType();
    extendedFieldURI.setPropertyTag(new PropertyTagType(new UnsignedShort(0x3A43)));
    ExtendedPropertyType extendedProperty = new ExtendedPropertyType();

    and the exception that I got is -

    (AxisFault): The request failed schema validation: The 'PropertyTag' attribute is invalid - The value '' is invalid according to its datatype ''

    Please let us know whether we are missing something.

    Thank you.


    - Bhagya 

    Tuesday, March 29, 2011 10:44 AM
  • I don't use AXIS the code i gave for .NET proxies that works okay it looks like a problem with they way you treating the datatype maybe will help you should treat the ropertyTag as a string


    Wednesday, March 30, 2011 2:15 AM