locked
EWS 2.0 Exchange 2010 Create/Update contact http://schemas.microsoft.com/exchange/services/2006/types:BusinessHomePage' element is invalid RRS feed

  • Question

  • Hi All, 

    I've built a windows service which retrieves contact data from a web service and creates/updates contacts in exchange using EWS.

    I am receiving the error: 

    7608 Exception 12/8/2013 3:45:48 PM The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:BusinessHomePage' element is invalid - The value 'http://www.fdcreports.com (redirecting to Elsevier web)' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:anyURI' - The string 'http://www.fdcreports.com (redirecting to Elsevier web)' is not a valid Uri value.

    This error causes the create/update of the contact in exchange to fail.

    Obviously the URI is invalid as it contains some extra text and there are many examples of this (or multiple URLs in the data). However, my client points out to me that in Outlook and Outlook web access it is possible to save any text you like in this field when creating a contact. I would like to have my windows service do the same, and client requires it.  

    I guess what I want to ask; is there a way to bypass the schema validation and let the Contact.Update/Create call run successfully even if the URI is not a valid URI??

    Code is fairly straight forward:

    Microsoft.Exchange.WebServices.Data.Contact nContact = new Microsoft.Exchange.WebServices.Data.Contact(EWSService);
                        nContact.FileAsMapping = FileAsMapping.SurnameCommaGivenName;
                        nContact.GivenName = ResultSet.GetString(ResultSet.GetOrdinal("FirstName"));
                        nContact.Surname = ResultSet.GetString(ResultSet.GetOrdinal("LastName"));
    nContact.BusinessHomePage = ResultSet.GetString(ResultSet.GetOrdinal("WebSite"));
    
    nContact.Save(TargetFolderId);
    

    Any help would be really appreciated!

    Cheers

    Lucas


    LucasF

    Sunday, December 8, 2013 5:32 AM

Answers

  • I don't think you can override the behaviour on the strongly typed property (you could probably debate with Microsoft over whether that's a bug in EWS).

    You can set the property how you want using the Extended Property definition instead eg

                ExtendedPropertyDefinition PR_BUSINESS_HOME_PAGE = new ExtendedPropertyDefinition(0x3A51, MapiPropertyType.String);
                nContact.SetExtendedProperty(PR_BUSINESS_HOME_PAGE,"http://blahblahlblah.com (ddadA d)");

    If you want to update in the future you would need to use the same method as well.

    Cheers
    Glen

    Monday, December 9, 2013 3:44 AM

All replies

  • I don't think you can override the behaviour on the strongly typed property (you could probably debate with Microsoft over whether that's a bug in EWS).

    You can set the property how you want using the Extended Property definition instead eg

                ExtendedPropertyDefinition PR_BUSINESS_HOME_PAGE = new ExtendedPropertyDefinition(0x3A51, MapiPropertyType.String);
                nContact.SetExtendedProperty(PR_BUSINESS_HOME_PAGE,"http://blahblahlblah.com (ddadA d)");

    If you want to update in the future you would need to use the same method as well.

    Cheers
    Glen

    Monday, December 9, 2013 3:44 AM
  • You've done it again Glen! Worked a treat! Thanks very much.
    Lucas

    LucasF

    Friday, January 24, 2014 1:30 AM