none
[EWS][C#] DeleteItemFieldType on contact with email address of the logged user RRS feed

  • Question

  • My code use a generated proxy of the exchange web service, the server is exchange 2013.
    I'm deleting the email address 1 of a contact with DeleteItemFieldType.

    DeleteItemFieldType deleteItem = new DeleteItemFieldType();
    PathToIndexedFieldType path = new PathToIndexedFieldType();
    path.FieldURI = DictionaryURIType.contactsEmailAddress;
    path.FieldIndex = EmailAddressKeyType.EmailAddress1.ToString();
    deleteItem.Item = path;

    It was not working with exchange 2010  (email address was still in the contact information) but it does work well with exchange 2013, maybe too well.

    I'm logged in OWA with the user test@test.com.
    The contact in OWA has the same email address in EmailAddress1 (test@test.com)

    If I delete this emailaddress from the contact information (with ews, with DeleteItemFieldType), I will have a weird reaction in OWA.
    I will not be able to see the contact list of the user anymore, it will just show "No items were found."

    If I search the contact (the one I removed the email address), I will have the error "the connection to the server failed"
    If I search an other contact I will be able to have the result.

    If I remove the email address of an other contact (and with an other email address as the one logged) I don't have any problem.

    Is this normal?


    Thursday, March 21, 2013 5:25 PM

Answers

  • I now add/edit/remove emails like suggested in an other thread (I can not put link) I fill the mapi properties.

    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);

    If emails are added with the usual email table, they are saved as "EX" (PidLidEmail1AddressType) if the email is also an exchange email address.
    This seems to cause this issue. Now with "SMTP" type, everything looks fine.

    • Marked as answer by lalainjoey Thursday, August 29, 2013 4:53 PM
    Thursday, August 29, 2013 4:53 PM

All replies

  • Additional information:

    The problem also occurs if the deleted email address is an other user part of the domain. For example, if I add the default administrator email address to a contact (administrator@test.com) and then delete the email address from the contact information with EWS, I will not be able to show the contact again from owa ( it always shows the error "the connection to the server failed" while searching him) and the contact list will seems to be empty.

    From EWS I will still be able to retrieve the contact information.

    If I do all this from owa (adding a contact with "administrator@test.com" as email address, delete the email address and save) the contact will still have "administrator@test.com" in his information and this email address (in field name "directory") will not be editable.

    Wednesday, March 27, 2013 8:53 AM
  • I now add/edit/remove emails like suggested in an other thread (I can not put link) I fill the mapi properties.

    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);

    If emails are added with the usual email table, they are saved as "EX" (PidLidEmail1AddressType) if the email is also an exchange email address.
    This seems to cause this issue. Now with "SMTP" type, everything looks fine.

    • Marked as answer by lalainjoey Thursday, August 29, 2013 4:53 PM
    Thursday, August 29, 2013 4:53 PM