OfficeDev / ews-java-api

A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
MIT License
868 stars 559 forks source link

ServiceResponseException: Cannot query rows in a table. #607

Open fedorareis opened 7 years ago

fedorareis commented 7 years ago

I am getting the calendar data for a number of users in my organization. For most of the users my code works fine, but I just came across a user that throws the following exception and stack trace.

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: Access is denied. Check credentials and try again., Cannot query rows in a table.
        at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
        at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
        at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
        at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:985)
        at microsoft.exchange.webservices.data.core.service.folder.Folder.internalFindItems(Folder.java:421)
        at microsoft.exchange.webservices.data.core.service.folder.CalendarFolder.findAppointments(CalendarFolder.java:137)

If I look up the users Calendar manually in outlook, it comes up just fine. When I searched around online for the error a lot of things addressed the first portion of the exception, but nothing seemed to address the Cannot query rows in a table. portion. Any thoughts or advice would be welcome.

kentongray commented 6 years ago

@fedorareis we are running into the same problem did you ever find anything out?

fedorareis commented 6 years ago

@kentongray I just looked back over the code I wrote that was having this issue. It appears that I never figured out a proper answer. I ended up just catching the value, marking the calendar as inaccessible, and moving on. I wish I could be of more help.

davster commented 6 years ago

I assume that this is a non-owner access call? The error seems to indicate that the caller does not have rights to access the folder in question. The "cannot query rows in a table" is coming from the underlying Exchange store, likely from an ACL check failure. Assuming that this is indeed non-owner access, verify from the target mailbox's account that the caller is properly set up as a delegate with the correct rights.

MarkRBM commented 6 years ago

thanks @davster in our particular case (same as Kentons) the exchange server administrators swear blind its set up correctly and the other folders work, CalendarItems etc. The problem folder for us is DeletedItems.

This exception also triggers a quarantine of the room so we can test the connection once then have to go to them to get the room un quarantined. this particular problem exchange installation is 2013 but the same code works fine on other 2013 installations

yummymell0w commented 5 years ago

@MarkRBM were you able to find a solution to that issue? Same happens here when running FindItem request against Deleted items folder. Mailbox is hosted on Exchange 2013.