none
Not able to set Notes in contact of Exchange 2010 using EWS Managed API RRS feed

  • Question

  • Can any one please let us know how to set "Notes" of contact in Exchamge 2010 using EWS Managed API? We tried to use "Notes" property of contact class but it is refered to as read only property.

    Is there some other property or technique for setting "Notes" of contact using EWS Managed API

    Tuesday, October 23, 2012 7:04 AM

All replies

  • To set the Notes of a Contact you use the Body Property as this is where the Notes are held, this wont be returned in a FindItems operations so you need to make sure you use Load or LoadPropertiesFromItems and a PropertySet the includes this property.

    Cheers
    Glen

    Wednesday, October 24, 2012 12:04 AM
  • Thanks for the reply. It worked. But i still have two queries :-

    1.  I thik it would be a slow process of getting contact information. Firstly i will fetch contact from the server. Then using the fetched contact object i will again query using Load() method. By this method i will have two make two queries to exchange server. Do we some other optimized way?

    2. We are also facing issue with Suffix property. We are not able to set/get "Suffix" property of a contact using EWS Managed API. We saw there is a property named "CompleteName.Suffix" of contact object. But this is a read only property. Is there some other property or technique for setting/getting "Suffix" of contact using EWS Managed API

    Wednesday, October 24, 2012 5:47 AM
  • 1.  Firstly you need to define how you have fetched the Contact if you have used a FindItems Operation to find the Contact in question you will need to make an additional call to the Exchange Server to return the Body property because "The FindItem operation returns only the first 512 bytes of any stream-able property. For Unicode, it returns the first 255 characters by using a null-terminated Unicode string. It does not return any of the message body formats or the recipient lists." http://msdn.microsoft.com/en-us/library/exchange/aa566107(v=exchg.140).aspx.

    If your doing this for a large number of Contacts then use LoadPropertiesFromItem which basically does a Batch getItem http://blogs.msdn.com/b/exchangedev/archive/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services.aspx . This is the optimized way of doing this.

    If you know the EWSid of the contact then you get Body during the initial bind call eg use the overload that allows you to specify the PropertySet you want to load for the Item you binding to.

    2. You'll will find for some properties on Items you will need to use the Extended Property Definition rather then the Strongly type property. http://msdn.microsoft.com/en-us/library/exchange/dd633691%28v=exchg.80%29.aspx the suffix is one of these so you would need to use

                ExtendedPropertyDefinition PidTagDisplayNamePrefix = new ExtendedPropertyDefinition(0x3A45, MapiPropertyType.String);
                cnt.SetExtendedProperty(PidTagDisplayNamePrefix, "Dr");
                cnt.Update(ConflictResolutionMode.AlwaysOverwrite);
    Cheers
    Glen
    Wednesday, October 24, 2012 6:38 AM