none
[E2007][E2010][EWSMA][C#] EWS Managed API: The element at position xxx is invalid RRS feed

  • Question

  • Hi there,
    When using the method LoadPropertiesForItem on Contact items, I'm getting the following error:
    2011-12-13 13:13:43,977 [6] - System.ArgumentException: The element at position 137 is invalid
    Parameter name: items ---> System.ArgumentNullException: Value cannot be null.
    Parameter name: collection[137]
       at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParam(Object param, String paramName)
       at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParamCollection(IEnumerable collection, String paramName)
       --- End of inner exception stack trace ---
       at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParamCollection(IEnumerable collection, String paramName)
       at Microsoft.Exchange.WebServices.Data.ExchangeService.LoadPropertiesForItems(IEnumerable`1 items, PropertySet propertySet)
    
    

    I'm using the latest version of the API (1.1).
    The position number in the error message (the xxx) is not always the same.
    The error occurs only for one of our customer using our application, I was not able to reproduce the problem myself.
    Any idea what could be wrong?
    Thanks for your help,
    Alexandre
    Monday, December 19, 2011 1:01 PM

All replies

  • I've had this in the past and generally its caused by one particular item in the store returning invalid data which the easiest fix is to delete and recreate that item (even usually just exporting the item, delete then re-import the same item will fix it). The hard part can be to find which item is causing problem i generally just use a script to enumerate all items and the call load with the same property-set your trying to load with LoadPropertiesForItems and you should get the same error doing a GetItem request on the Item that is causing problems.

    Cheers
    Glen

    Tuesday, December 20, 2011 2:07 AM
  • Hi Glen,

     

    Thanks for your answer.

    I still do not understand why the Exchange Managed API does not handle such bug... The solution of re-creating the contact is ok until a new bad contact will be created.

    For now, I guess I don't have any other choice than loading the contacts one by one, then log and ignore the contacts getting this ArgumentException.

     

    Anyway, I would be glad to hear if someone has a better alternative/fix for this!

     

    Alexandre

     

     

    Tuesday, December 20, 2011 5:04 PM