none
EWS access to contact fields RRS feed

  • Question

  • Hi Pros,

    referring to this post I can create a contact in public Folders via ews. This works fine so far but when I try to send further attributes like Nickname for example I get a "ErrorSchemaValidation". Because I am sending the Message from BizTalk, I create the actual SOAP XML directly, if I understood the following site correctly, a <Nickname> should be allowed as child of contact.

    <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
      <SavedItemFolderId>
        <FolderId Id="XXXXXXA="ChangeKey="XXXXXX"xmlns="http://schemas.microsoft.com/exchange/services/2006/types"/>
      </SavedItemFolderId>
      <Items>
        <Contact xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
          <FileAs>Max, Mustermann</FileAs>
          <GivenName>Adam</GivenName>
          <CompanyName>CompanyName<CompanyName>
          <EmailAddresses>
            <Entry Key="EmailAddress1">welt@hallo.uik</Entry>
          </EmailAddresses>
          <JobTitle>Friend</JobTitle>
          <Surname>Muster</Surname>
          <Nickname>thisdontwork</Nickname>
        </Contact>
      </Items>
    </CreateItem>
    So what might be wrong about this message?
    Sunday, July 7, 2013 11:18 AM

Answers

All replies

  • The order of the elements in the SOAP message is critical for Exchange eg if you refer to http://msdn.microsoft.com/en-us/library/exchange/aa581315(v=exchg.140).aspx the NickName element should be before EmailAddresses.

    Cheers
    Glen

    • Marked as answer by Trombone Thursday, July 11, 2013 10:50 AM
    Monday, July 8, 2013 6:18 AM
  • Hi Glen,

    makes sense and works fine, thanks!

    I have a similar issue with the FindItem message, when searching for the nickname the following message works. when I replace nickname by other properties like 'ContactSource' or 'DirectoryId' I get a 'ErrorUnsupportedPathForQuery' error. What is the difference between these elements and how can I know it if not from this site ?

    <FindItem Traversal='Shallow' xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>
          <ItemShape>
            <BaseShape xmlns='http://schemas.microsoft.com/exchange/services/2006/types'>IdOnly</BaseShape>
            <AdditionalProperties  xmlns='http://schemas.microsoft.com/exchange/services/2006/types'>
              <FieldURI FieldURI='contacts:Nickname' />
            </AdditionalProperties>
          </ItemShape>
          <IndexedPageItemView MaxEntriesReturned='2' Offset='0' BasePoint='Beginning'/>
          <Restriction>
            <Or  xmlns='http://schemas.microsoft.com/exchange/services/2006/types'>
              <Contains ContainmentMode='FullString' ContainmentComparison='Exact'>
                <FieldURI FieldURI='contacts:Nickname' />
                <Constant Value='{0}' />
              </Contains>
            </Or>
          </Restriction>
          <ParentFolderIds>
            <FolderId Id='{1}' ChangeKey='{2}' xmlns='http://schemas.microsoft.com/exchange/services/2006/types' />
          </ParentFolderIds>
        </FindItem>

    Monday, July 8, 2013 8:43 AM
  • With FindItems you can only use this to search Items located in one particular folder (I'm guessing you're searching a particular user contacts folder).

    'ContactSource' tells you if a Contact is located in an Exchange Folder or the Global Address List and would only be returned when you using ResolveName Operation to tell you if the Contact was resolved in the Directory or the local Contacts Folder. With FindItems you will only ever get contacts from a Exchange folder returned.

    Whether you can search on a particular Item property is property specific and there no list that I know of that tell you if a particular Strongly Typed property will be searchable but the two you mentioned aren't. If you want to return the GAL contact just use the ResolveName operation and specifying to return the Contact. Another option if your using Exchange 2013 is the FindPeople operation http://msdn.microsoft.com/en-us/library/exchange/jj190898(v=exchg.150).aspx which takes advantage of personas.

    Cheers
    Glen

    Tuesday, July 9, 2013 7:11 AM