EWS Managed API: How to remove Email1, Email2, Email3 from a contact

An interesting case recently asked how to remove Email1, Email2, and/or Email3 from a contact using the EWS Managed API.  If you try to set any of these properties to null, or an empty string, then you will receive an error when sending the request to Exchange (i.e. when you call Update()).

There are various posts and threads discussing this that can be found, but I thought I’d clarify here exactly what needs to be done to delete any or all of these properties.  First of all, you can’t use the Contact object properties directly to remove these items.  What you need to do is use extended properties to remove all MAPI properties that relate to the field in question.  The extended properties are:

 // Property definitions for Email1
public static ExtendedPropertyDefinition PidLidEmail1DisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8080, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail1AddressType = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8082, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail1Address = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8083, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail1OriginalDisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8084, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail1OriginalEntryId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8085, MapiPropertyType.Binary);
ExtendedPropertyDefinition[] Email1PropertyGroup = new ExtendedPropertyDefinition[5]{ PidLidEmail1DisplayName,

// Property definitions for Email2
public static ExtendedPropertyDefinition PidLidEmail2DisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8090, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail2AddressType = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8092, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail2Address = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8093, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail2OriginalDisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8094, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail2OriginalEntryId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x8095, MapiPropertyType.Binary);
ExtendedPropertyDefinition[] Email2PropertyGroup = new ExtendedPropertyDefinition[5]{ PidLidEmail2DisplayName,

// Property definitions for Email3
public static ExtendedPropertyDefinition PidLidEmail3DisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x80A0, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail3AddressType = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x80A2, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail3Address = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x80A3, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail3OriginalDisplayName = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x80A4, MapiPropertyType.String);
public static ExtendedPropertyDefinition PidLidEmail3OriginalEntryId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Address, 0x80A5, MapiPropertyType.Binary);
ExtendedPropertyDefinition[] Email3PropertyGroup = new ExtendedPropertyDefinition[5]{ PidLidEmail3DisplayName,

 Once you have the above, it is very straight-forward to delete one of the properties.  For example, to delete Email1:


 I’ve attached to this post a sample application that allows you to create a contact and then remove any of the email addresses.

There is now a code sample available at http://code.msdn.microsoft.com/Exchange-2013-Delete-290ec427 .  Note that while it refers to Exchange 2013, the same technique works with Exchange 2010.  The code on this page has been tested against Exchange 2010.


Comments (3)

  1. Carl Clark says:

    Thank you for the post, this solution worked for me.  I am very curious to understand why the following doesn't work or rather is not handle by the EWS API:

    MyContact.EmailAddresses[EmailAddressKey.EmailAddress1] = String.Empty;

  2. xinxin says:

    I tried this solution, I am using EWS java 1.2 (Exchange2010), and I have to use a loop to remove extended properties 5 time to delete the Email1, it does not make any sense to me.


    for(int i = 0; i < 5; i++)


     Contact oContact = Contact.bind(service, itemId, EmailPropertySet);      








  3. Josef Dubisar says:

    I'd really love to make this work, but I can't. Any other way than this (.EmailAddresses(EmailAddressKey.EmailAddress1) = "") ends up an error. When I try to use the code above, there is no error, but also no effect – the email address still stays in the contact. I'm going slightly mad over this.

    Would you have any suggestion for me, please contact me: dubisar@softech.cz

    Thank you, Josef.