Question

We're using Exchange 2007 WS to process mail folders and are hitting various problems if we try and forward a message we've already received. Our process is:

  • Windows Service monitors mailbox folder, on finding a new mail we process the information and move the item to a 'Processed folder' and store the Exchange Message Id.
  • Users may opt to forward the mail externally. We use the Exchange API to find the item using the Message Id we stored earlier, and then again use the API to forward.

Except finding the mail again is proving rather flaky. We regularly get the following error:

The specified object was not found in the store.

Is there a better/more reliable way we can achieve the same? The documentation for Exchange WS is rather sparse.

Was it helpful?

Solution

This is a bug in microsoft exchange manage API. here is a link for more information http://maheshde.blogspot.com/2010/09/exchange-web-service-specified-object.html

OTHER TIPS

Are you saving the Message ID of the newly found message or the message once it has been moved to the 'Processed' folder? The id will change when it moves to a new folder.

The method recommended in the book Inside Microsoft Exchange Server 2007 Web Services is to grab the PR_SEARCH_KEY (0x300B, Binary) of the newly discovered item, then move it to the 'Processed' folder. You can then search for it in the new folder based on the PR_SEARCH_KEY and get it's new Message id to forward it.

I have come to the conclusion that this happens to me is because while my app is processing the emails, someone else is fiddling with an email at the same time.

So to cure the problem, I put it the code in a try catch and see if the exception is == the that object not found in store, if so I just skip it and move on to the next item. So for has no issues.

I wrote a program that reads the emails in inbox downloads attachments to the specified folder, wrote the email info and the saved path to the database, and finally deletes the email. I run this program as a windows service. After all tests are finished I run this program to the main server and run it. Program runs successfully but sometimes I got this error. I checked everything and finally I found that I forgot to stop service on my computer. 2 programs that runs on my computer and on real server checking the same mailbox at the same time. If you get this error make sure that only one program can process at the same mailbox.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top