How to set Home address fields to Null using Managed API? RRS feed

  • Question

  • Hi,

    I am using VS 2008, Exchange server 2007 sp1, Managed API 1.1 and C#

    While updating public folder contact fields I am trying to set Address fields (Business and Home Address) to null.

    To Set all Business Address fields I am handling these fields using their property IDs as shown bleow:

    public ExtendedPropertyDefinition BusinessAddressStreet = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 32837, MapiPropertyType.String);

    public ExtendedPropertyDefinition BusinessAddressCity = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 32838, MapiPropertyType.String);

    etc ..


    and then in my update method:

    I am adding these properties to my contact property set and binding to contact using exchange service and contact unique Id then


    for (int index = 0; index < contact.ExtendedProperties.Count; index++)

           if (contact.ExtendedProperties[index].PropertyDefinition.Id.HasValue)
                            if (contact.ExtendedProperties[index].PropertyDefinition.Id == CMSExtdPropContants.BusinessAddressStreet)
                                contact.ExtendedProperties[index].Value =
                                (string.IsNullOrEmpty(cmsRecord.BusinessStreetAddress)) ? " " : cmsRecord.BusinessStreetAddress.Trim();




    By using above procedure I am able to set all Business address fields to null in one run but when I am using the same whit Home address fields it is not working for Home address fields, Even extended properties for Home address are not coming.


    For Home Address Fields :

      public ExtendedPropertyDefinition HomeAddressStreet = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 14941, MapiPropertyType.String);


    in this DefaultExtendedPropertySet.Address is correct or not ?

    any code snippet will be very helpful for me.


    What may be the cause for this problem?

    Is there any way to set these address fields to null?


    Thanks in advance.



    Friday, January 21, 2011 4:51 AM