Resources for IT Professionals > 포럼 홈 > Development > Create contact without email address EWS Managed API 1.0
질문하기질문하기
 

제안된 답변Create contact without email address EWS Managed API 1.0

  • 2009년 11월 17일 화요일 오전 8:15DEX22 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hello all,

    When I try to create contact without email address, I get this error:

    The request failed schema validation: The element 'EmailAddresses' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has incomplete content. List of possible elements expected: 'Entry' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.

    Having an empty string as the address causes the 'ErrorCorruptData' error to be thrown. Also updates fails and cause an error with the following message:

    An object within a change description must contain one and only one property to modify

    How does one create contacts with no email addresses?
    The target server is Exchange Server 2007 SP2
    Any help will be appreciated

    Thanks

모든 응답

  • 2009년 11월 17일 화요일 오후 9:57Jeff Smith 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    That's a really good question.  I had a test project using the older version of the EWS Managed API using the April2009 beta and was able to create new contacts with blank emails by simply setting oContact.EmailAddresses(EmailAddressKey.EmailAddress1) = ""
    Worked very well.

    For updates, I just had to set oContact.EmailAddresses(EmailAddressKey.EmailAddress1) = NOTHING to blank it out and that worked.

    Just trying to update the code to the released API v1.0 and now none of that works and getting the same things as you.
  • 2009년 11월 23일 월요일 오후 2:25Jeff Smith 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    So, don't know about Dex22, but I am definately still struggling with this. 

    Breaking it down to a very simple application, the following crashes out with the error listed in the original question above for me:

    Dim oContact As New Contact(Me.mExchange)
    oContact.GivenName = GetExchangePropertyString("Test Name")
    oContact.Save(oFolder.Id)

    This type of task of course works directly from outlook as you can create a new contact in a folder and just fill in a name with no email address.  But this errors out with a complaint about the schema validation of the 'EmailAddresses'

    If I add these two lines (putting in a valid email address), it of course works fine.

     

    Dim oEmailAddr As EmailAddress
    oEmailAddr =

    Dim oEmailAddr As EmailAddress
    oEmailAddr =

    New EmailAddress(oInfo.Email1DisplayName, "test1@test.local")
    oContact.EmailAddresses(EmailAddressKey.EmailAddress1) = oEmailAddr

    I have tried all sorts of variations on trying to set the emailaddresses(emailaddresskey.emailaddress1) to various things.  Empty/New emailaddress objects, nothing, etc...  Always crashes out on me.

     

     

  • 2009년 11월 24일 화요일 오후 8:22Jeff Smith 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Okay, so I have my stuff working but am very concerned about it.  Just wanted to post my results here for others who might struggle with this as I have.

    On two different Exchange servers, two different versions of the code worked.

    On One server, the code I posted above worked where I just created the contact, set the givenname field, and hit save.

    On another server, I had to go ahead and create a new emailaddress and use "" as the value for both the name & address properties and then set that to the oContact.EmailAddresses(EmailAddressKey.EmailAddress1).

    Very strange.  Going on with life now and hoping it won't break both boxes.  Both are on the same rollup even.  Exchange Server 2007 SP 1 Rollup 9.
  • 2010년 3월 10일 수요일 오전 8:00321X 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    What was your solution?

    I've started a new thread about this because no one really answered this question.

    I'm using EWS Managed API and Exchange Server 2007 with the latest updates.
  • 2010년 3월 11일 목요일 오후 6:07David Claux - MSFT 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     제안된 답변
    Please refer to my response on the other thread: http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/2288f7e9-2d34-4fe1-838e-ba39290dc5f0
    David Claux | Program Manager - Exchange Web Services