EWS Error Code: ErrorItemNotFound
Posted by Lars Talaschus on 12 Jan 2017 14:13
Problem: While archiving email from a Microsoft Exchange server or Office 365 the following error occurs:
Microsoft Exchange Server was unable to complete the task. Details: The specified object was not found in the store. EWS Error Code: ErrorItemNotFound.
This error may occur under different circumstances.
1: It mostly occurs when the Outbox folder is being archived. MailStore first retrieves a list of message IDs of a folder, then it fetches the message headers belonging to these IDs. Since a message usually is only in the Outbox folder for a very short period of time, the message is already gone, when the headers should be fetched.
Solution: Exclude the Outbox folder from being archived. The messages are archived from the Sent Items folder.
2: You are using a loadbalancer in front of your Exchange servers. Due to the replicatation mechanism the mailbox databases on the Exchange servers are not always identical. MailStore tries to fetch messages headers of IDs which have been received from another server, which are not present on the currently queried server.
Solution: Configure the archiving profile to connect directly to one of the Exchange servers instead of connecting to the loadbalancer or make sure the loadbalancer is not switching between servers during a session.
Due to that error the archiving profile itself terminates with a non-successful status code. This behavior can be changed since MailStore Server 10 by modifying the global property public.arcclient.skipEwsErrorItemNotFound by executing the following command in MailStore's Management Shell:
store-setprop --name="public.arcclient.skipEwsErrorItemNotFound" --value="true"
Please note: Independent of this global property, MailStore Server is neither able to archive messages where the above error occurred nor delete them from the Exchange server.