none
EWS 2.0 (Exchange 2007 ) - How to Bulk Update Contacts RRS feed

  • Question

  • Hi 

    I have  afew hundred contacts that I need to auto-refresh in Exchange 2007 via EWS 2.0. Speed is not that great.

    Can someone please provide an example of how I could bulk update 25 contacts and clearly identify which ones failed because they did not exist? Which I wonder is even possible without knowing the ItemId before hand?

    Thanks

    Wednesday, November 19, 2014 9:30 AM

All replies

  • >> Which I wonder is even possible without knowing the ItemId before hand?

    You can't perform an update unless you have the ItemId and latest ChangeKey. What I would suggest is that you post the code you have and then we can help you make that more efficient. What you should be using is a Batch UpdateItems call but you will need to have some sort of logic to get the existing contact's ItemId before you issue your update call which would put context on what your trying to do. The updateItems request is done in order so if you submit 5 updates you get five response in the order you submitted them. You need to submit order to work out if your request failed or succeeded from the service response.

    Cheers
    Glen

    Thursday, November 20, 2014 3:22 AM
  • So affectively your saying, I would either need to store the ItemId's outside exchange and within my application or search to get all ItemId's for the records I want to update?

    Makes sense. So leading onto my next question, is there a efficient method where by I could return all ItemId's for Contact records that matched a number of email addresses?

    Thanks

    Thursday, November 20, 2014 2:26 PM
  • How many contacts are in the source folder ?

    You could create a really complex SearchFilter using multiple OR statements it would be pretty ugly and possibly slow unless you have some massive number of contact you should generally just be able to enumerate the contacts with a restricted propertyset for the contact first. If you are updating all the contacts from a certain domain then just create a single search filter on that domain or try to find some other property you can create a simpler SearchFilter using. You can also create your own custom properties you can use in searches http://msdn.microsoft.com/en-us/library/office/dd633654%28v=exchg.80%29.aspx .

    Cheers
    Glen

    Friday, November 21, 2014 3:31 AM