Reading Calendar with EWS Managed API throwing (The specified object was not found in the store)
- Hi, Im developing an application using the new API for accessing an exchange 2007 but have some issues that pretty much is a show stopper!
The scenario is as follows. The application checks Calendar appointments for a group of users and sends out reminders to them when certain conditions are met.
First of is that the user I am using for the credentials is denied access but the same user has access using webdav.
using my own AD account works thou but then I run into next problem while doing a calendar.findAppointment to a calendar I have bound to a a certain user i get an exception (The specified object was not found in the store) This only happens on some users and I know that they exists and I can access their calendar with webdav.
I had it working for a while using "service.UseDefaultCredentials = true;" and then I could read all calendars but that stopped working after trying setting credentials manually and then swithing back I had the same problem with that some peoples accounts throws (The specified object was not found in the store). and some throwing ("The specified folder could not be found in the store.").
using UseDefaultCredentials works one some of the users that didn't work if I manually set the Credentials to the same account. very strange.
My code:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Credentials = new NetworkCredential(CREDENTIAL_NAME, CREDENTIAL_PASSWORD, CREDENTIAL_DOMAIN); ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; service.Url = new Uri(SERVICE_URL); CalendarFolder calendar = CalendarFolder.Bind(service, new FolderId(WellKnownFolderName.Calendar, userMail)); FindItemsResults<Appointment> myApp = calendar.FindAppointments(new CalendarView(DateTime.Now.AddMonths(0 - timeSpanMonths), DateTime.Now.AddDays(0 - DAYSBACK)));
I have tried Autodiscover aswell and that didn't do any diffrence.
All Replies
- Some progress - I have now found out why it worked before, it's the span of how many days I shall get. If I set it to go back 30 days it works and those 2 accounts that got the "The specified object was not found in the store" expection now gets found. The strange part is that Im trying to go back 6 month back and obtain appointments and it works for some of the users but not 2 of them. is there any strange limit I have to change?
- I have now found that this must be a bug in the API. It happens for some ppl at some specifik dates.
Anyone have a solution for this? - Oscar,
The user that you use the credentials of to authenticate to EWS must have delegate access rights (for instance, read access) to the calendar folder of the user you are trying to access. In your case, given the sample above, the user represented by CREDENTIAL_NAME must have read access to the calendar of the user represented by userMail. Please verify that acess rights are setup properly (using Outlook for instance).
FYI, when you set UseDefaultCredentials to true, you authenticate as the user that is logged into the machine that is running your application. If that user does not have read access rights to userMail's calendar, you will get an error.
Note that the error you receive (The specified object was not found in the store) is an error returned by EWS, it is not an error thrown locally by the EWS Managed API. Furthermore, I believe the error indicates that the folder you are trying to access was not found, which is the error that you should expect when the authenticated user does not have read access to another user's folder.
You can turn on tracing (service.TraceEnabled = true) to take a look at the XML request/response exchanged by the API and EWS. Also, the exception you received probably has more information embedded, you might want to take a look at them.
David Claux | Program Manager - Exchange Web Services - The thing is that the reading problem (The specified object was not found in the store) happens to some users when collecting the appointments. For example : If i have user A and B and i get their appointments 2 month back in time I get both user A and B:s appointments but if I select 5 months back user A returns the appointments but I get a T(he specified object was not found in the store) on user B, which worked prior. So access to the calendar can't be the issue since I can read it depending how long back I go. I tried getting just that month 5 month ago and the same error accoured. So I suppose the error must be in the webservice then?
Im gonna check the Trace so see what turns up. - Here is the trace when it doesn't work. but with other intervall in dates it workes so Im puzzled and can't anything in the trace telling me what went wrong.
<EwsLogEntry EntryKind="EwsRequest" ThreadId="11" Timestamp="2009-06-08 08:54:05">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2007_SP1" />
</soap:Header>
<soap:Body>
<m:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:ItemShape>
<m:CalendarView StartDate="2008-12-25T07:53:54Z" EndDate="2009-01-25T07:53:54Z" />
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="calendar">
<t:Mailbox>
<t:EmailAddress>users_email@company.com</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
</EwsLogEntry>
<EwsLogEntry EntryKind="EwsResponseHttpHeaders" ThreadId="11" Timestamp="2009-06-08 08:54:05">200 OK
Content-Length: 942
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Date: Mon, 08 Jun 2009 06:53:28 GMT
Server: Microsoft-IIS/6.0
WWW-Authenticate: Negotiate oYGgMIGdoAMKAQChCwYJKoZIgvcSAQICooGIBIGFYIGCBgkqhkiG9xIBAgIGi89o9zMHGgAwIBBaEDAgEPomUwY6ADAgEXolwh86mtFsoawFkrsDzbhcnmvdh1+xqCocmE0uvEV6LPerP7h7ji45dYDonzxFDo7bAFM9fDhp59jIYVngpuzgOczlnm5nlvrbNhywWVg2K2dZ690ttZOwy3TFcU2AbiA==
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
</EwsLogEntry>
<EwsLogEntry EntryKind="EwsResponse" ThreadId="11" Timestamp="2009-06-08 08:54:05">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="359" MinorBuildNumber="2" Version="Exchange2007_SP1" A first chance exception of type 'Microsoft.Exchange.WebServices.Data.ServiceResponseException' occurred in Microsoft.Exchange.WebServices.dll
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<m:FindItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:FindItemResponseMessage ResponseClass="Error">
<m:MessageText>The specified object was not found in the store.</m:MessageText>
<m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
</m:FindItemResponseMessage>
</m:ResponseMessages>
</m:FindItemResponse>
</soap:Body>
</soap:Envelope>
</EwsLogEntry> - Has anyone a clue why the webservice is faulty?
- Hi oscarmaxHad the same problem - we solved it by locating the appointments in the users calenders (by narrowing the search) and deleting them. They where private appointments made from an extern domain.They somehow managed to spoil the whole search?!
- I am having the same intermittent problem as you reported - some accounts work, some accounts fail with the specified folder not found error. Like you posted, the trace does not yield any information. There are too many accounts in the domain to go through all of the calendar data and remove appointments as Uffe suggests works for him.
Oscarmax - did you solve your problem? If so, how?
Thanks,
Russ - What happens if you get GetUserAvailability for the mailbox with the problem for the date range you are specifying? Does it return the id of the offending item?
David Sterling | Microsoft Exchange Web Services | http://www.microsoft.com/MSPress/books/10724.aspx - David-I'm looking for 12 mos worth of data (historic, not future). GetUserAvailability is limited to 42 days. I broke the request up into eight requests I ran this on two accounts that previoiusly failed (a "finditem" request). The GetUserAvailability succeeded. It didn't return any guids, though, just F/B. Perhaps because I used RequestedView = DetailedMerge)? It was odd that on one of the users GetUserAvailability didn't get much history ... ~60days. I've asked someone to check to see if there was an issue with this calendar.
What else would you recommend I investigate to solve the "The specified object was not found in the store" problem?
Thanks,
Russ - David,
We initially created a "finditem" request for nine accounts to retreive calendar data for 12 months worth of history. Some succeeded, and some failed with EWS returning "The specified object was not found in the store". I reran the finditem test again for 30 days. This time only two of the nine accounts failed with the EWS error "The specified object....". Yet GetUserAvailability did not fail. Also know that these accounts are ROOM accounts, so they are disabled accounts. We access these account using "fullaccess" permissions. So it could be a permisions issue, although finditem requests seem to fail as a function of the time interval requested. Do you think it is a timeout setting -- I've set the HTTPTimeout settng to 200,000 ms. So far it does not seem to help.
Thanks for your thoughts on this issue.
Russ - David,
More update - We took three of those accounts that failed, and re-ran the "finditem" request for 30 days, 90 days, and 12 months (back in time). FindItem failed with "The specified object..." for all three accounts for all three time intervals. (Also, playing with the HTTPTime interval seems to have no effect on the result.)
I appreciate any suggestions you or the community might have. I am, so far, unable to solve this issue.
Thanks, as always, for your help.
Russ Do you know if any of the appointments involved have attachments? Possible mismatch between the hasattachments and hasattachmentsspecified properties?
Thanks for your response, mjolinor.
I do not know if there are attachments - but i strongly doubt it.
The calendars in question are "room" mailboxes. They have been configured to "autoaccept", and the default MailboxCalendarSettings have been configured to "DeleteAttachments".
I suspect the 'FullAccess' permissions are not being applied to sub-folders, have not been inherited, or have been reset for SOME of the rooms (even though they are all on the same machine, in the same store, and even in the same OU). We have scheled time to reapply the "-AccessRights:fullaccess" using "-InheritanceType: All" next week and see if it remains set. I'll post back with the results.


