C# Exchange WS '在存储中找不到指定的对象。错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/767760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Exchange WS 'The specified object was not found in the store.' error
提问by penderi
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:
我们使用 Exchange 2007 WS 处理邮件文件夹,如果我们尝试转发已收到的邮件,则会遇到各种问题。我们的流程是:
- 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.
- Windows 服务监视邮箱文件夹,在找到新邮件时,我们处理信息并将项目移动到“已处理文件夹”并存储 Exchange 邮件 ID。
- 用户可以选择从外部转发邮件。我们使用 Exchange API 使用我们之前存储的 Message Id 查找项目,然后再次使用 API 转发。
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.
有没有更好/更可靠的方法可以实现相同的目标?Exchange WS 的文档相当少。
采纳答案by Mahesh
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
这是微软交换管理 API 中的一个错误。这里是更多信息的链接 http://maheshde.blogspot.com/2010/09/exchange-web-service-specified-object.html
回答by Joe Doyle
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.
您是保存新找到的邮件的邮件 ID,还是保存已移动到“已处理”文件夹的邮件?当它移动到一个新文件夹时,id 会改变。
The method recommended in the book Inside Microsoft Exchange Server 2007 Web Servicesis 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.
《Inside Microsoft Exchange Server 2007 Web Services》一书中推荐的方法是抓取新发现项目的 PR_SEARCH_KEY (0x300B, Binary),然后将其移动到“Processed”文件夹中。然后,您可以根据 PR_SEARCH_KEY 在新文件夹中搜索它并获取它的新消息 ID 以转发它。
回答by cihata87
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.
我编写了一个程序,读取收件箱中的电子邮件,将附件下载到指定文件夹,将电子邮件信息和保存的路径写入数据库,最后删除电子邮件。我将此程序作为 Windows 服务运行。完成所有测试后,我将此程序运行到主服务器并运行它。程序运行成功,但有时我收到此错误。我检查了一切,最后发现我忘记停止计算机上的服务。在我的计算机和真实服务器上运行的 2 个程序同时检查同一个邮箱。如果您收到此错误,请确保只有一个程序可以在同一个邮箱中进行处理。
回答by Exzile
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.
所以为了解决这个问题,我把代码放在 try catch 中,看看异常是否 == 商店中没有找到的那个对象,如果是这样,我就跳过它并继续下一个项目。所以 for 没有问题。