none
Using EWS on Office 365 ends in 'ErrorTooManyObjectsOpened' RRS feed

  • Question

  • Hello,

    we have a problem with our sync-tool which is using the EWS to sync appointments between our calender and the exchange calender. One "service" account is in use to access the calender of users which will be synchronized and this is not done via impersonation. This works fine on the most customer setups, regardless if it is a local exchange system or a Office 365 account. 

    Now we have one customer that get's an error while loading properties for items. The error message is 'ErrorTooManyObjectsOpened'. So but this does not happen to all of the 20 users. Just a few, around 20 % get this error. Also if we temporary disable all users expect one which gets the error. 
    What makes me also very "confuse" is, that we can use FindItems/FindAppointments without errors and the following LoadPropertiesForItems get's the error. 

    Dim nPropertySet As New PropertySet(BasePropertySet.FirstClassProperties, nAdditionalProperties)
    nPropertySet.BasePropertySet = BasePropertySet.FirstClassProperties
    
    FindResult = Service.FindAppointments(New FolderId(WellKnownFolderName.Calendar, New Mailbox(MyUser.User.Email)), nCalenderView)
    
    For Each ObjAppointment As Appointment In nFindResult.Items
        ItemList.Add(ObjAppointment)
    Next
    
    Service.LoadPropertiesForItems(ItemList, nPropertySet)

    We are using the EWS Managed API to access the EWS.

    I found another post with this error, but the solutions does not work for us. We have done the "break" between the calls with a bigger resolution of 120sek every 5 users, but it does not work.

    So it looks like there is another limitation that I don't know yet.


    Monday, June 16, 2014 7:43 AM

Answers

  • >>What makes me also very "confuse" is, that we can use FindItems/FindAppointments without errors and the following LoadPropertiesForItemsget's the error.

    What happens when you do LoadPropertiesForItems is that it does a batch GetItem Operation. The error is a throttling error telling you that you have too many items open so doing a batch GetItem for too many objects would make sense (where as FindItems is just one op), putting in a time break probably won't help in this regards what you should look at doing is dialing back your batch size eg the number of Items you do a LoadPropertiesForItems on. Instead of working backwards I would suggest working up eg start with batches of 50 items and see if you get the same problem, if not increase this until you find the tipping point. Concurrency can be issue here if you have multiple threads using the same account you can still only be allowed to open 1000 Items open per account (this would be a big problem if you had a FindItems and GetItem request done concurrently using the same account).

    Have you tried using the X-AnchorMailbox header ? http://msdn.microsoft.com/en-us/library/office/dn458789(v=exchg.150).aspx . This header affects that way the request is load balenced and proxied if your accessing a Mailbox other then the secuirty context being used. I would suggest you try using the X-AnchorMailbox header and target the Mailbox your attempting to access. 

    The other thing you can do is that each request has a unique RequestId http://blogs.msdn.com/b/exchangedev/archive/2012/06/18/exchange-web-services-managed-api-1-2-1-now-released.aspx which can then be used to find any server side issues in the EWSLogs on the server. So you could open a support request with Microsoft and ask them to check why this is failing based on the RequestId. 

    Cheers
    Glen

    Tuesday, June 17, 2014 3:56 AM
  • Hi Florian,

    the solution provided by Glen seems to be right. The X-AnchorMailbox Header works.
    I have configured our EWS Service object like this...

    Service.HttpHeaders.Add("X-AnchorMailbox", strMailAddressToRead)
    Service.HttpHeaders.Add("X-PreferServerAffinity", "true")
    

    Hope this will help you...

    regards,

    S

    Tuesday, July 8, 2014 12:06 PM

All replies

  • >>What makes me also very "confuse" is, that we can use FindItems/FindAppointments without errors and the following LoadPropertiesForItemsget's the error.

    What happens when you do LoadPropertiesForItems is that it does a batch GetItem Operation. The error is a throttling error telling you that you have too many items open so doing a batch GetItem for too many objects would make sense (where as FindItems is just one op), putting in a time break probably won't help in this regards what you should look at doing is dialing back your batch size eg the number of Items you do a LoadPropertiesForItems on. Instead of working backwards I would suggest working up eg start with batches of 50 items and see if you get the same problem, if not increase this until you find the tipping point. Concurrency can be issue here if you have multiple threads using the same account you can still only be allowed to open 1000 Items open per account (this would be a big problem if you had a FindItems and GetItem request done concurrently using the same account).

    Have you tried using the X-AnchorMailbox header ? http://msdn.microsoft.com/en-us/library/office/dn458789(v=exchg.150).aspx . This header affects that way the request is load balenced and proxied if your accessing a Mailbox other then the secuirty context being used. I would suggest you try using the X-AnchorMailbox header and target the Mailbox your attempting to access. 

    The other thing you can do is that each request has a unique RequestId http://blogs.msdn.com/b/exchangedev/archive/2012/06/18/exchange-web-services-managed-api-1-2-1-now-released.aspx which can then be used to find any server side issues in the EWSLogs on the server. So you could open a support request with Microsoft and ask them to check why this is failing based on the RequestId. 

    Cheers
    Glen

    Tuesday, June 17, 2014 3:56 AM
  • hi Sascha,

    have you managed to solve the issue? I am receiving the same error in a similar situation when requesting appointments from an Office 365 room calendar by calling the ews FindAppointments() method.

    best regards, Florian

    Tuesday, July 8, 2014 11:15 AM
  • Hi Florian,

    the solution provided by Glen seems to be right. The X-AnchorMailbox Header works.
    I have configured our EWS Service object like this...

    Service.HttpHeaders.Add("X-AnchorMailbox", strMailAddressToRead)
    Service.HttpHeaders.Add("X-PreferServerAffinity", "true")
    

    Hope this will help you...

    regards,

    S

    Tuesday, July 8, 2014 12:06 PM