ArgumentException on async Folder.Bind and Service.FindItems RRS feed

  • Question

  • hi,

    we use EWS Managed API to Sync our CRM with the Exchange-Server. As long as I used EWS Mangage API 1.1 everything worked perfect. Now I updated to Api 2.0 (Dll-version: 15.0.516.14) and I'm getting an ArgumentException if I bind to the same Folder from diffrent threads and don't understand why.

    Here's a samplecode which raises the exception:

    private void TestAsyncFolderGet() { try { ExchangeService service = this.GetService(); Parallel.For(0, 20, (i) => { Folder fo = Folder.Bind(service, WellKnownFolderName.Inbox); });

    } catch (Exception ex) { this.State = "Failed: " + ex.Message; } } private ExchangeService GetService() { ExchangeService result = new ExchangeService(ExchangeVersion.Exchange2010); result.AutodiscoverUrl(""); return result; }

    My real scenario is that im getting changed items using a pullsubscription and handle the changes async. While doing this I'm binding to the parentfolder to get some informations.

    Can anyone help me avoid the Exception?

    Wednesday, February 27, 2013 10:33 AM