gpt4 book ai didi

exchangewebservices - "The specified object was not found in the store"异常

转载 作者:行者123 更新时间:2023-12-02 21:48:46 24 4
gpt4 key购买 nike

当我在请求订阅的帮助下获取创建的事件或通知时,为什么会出现“在商店中找不到指定的对象”异常?

EWS SOAP 响应如下所示:

<Trace Tag="EwsResponse" Tid="1" Time="2013-09-27 12:38:43Z" Version="15.00.0516.014">
<?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="3" MajorBuildNumber="83" MinorBuildNumber="4" Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<m:GetItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:GetItemResponseMessage 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:Items />
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</soap:Body>

这是我的代码:

PullSubscription subscription = service.SubscribeToPullNotifications(
new FolderId[] { WellKnownFolderName.Inbox }, 1, WaterMark,
EventType.NewMail, EventType.Created, EventType.Moved, EventType.Deleted);
WaterMark = subscription.Watermark;

// Initiate the GetEvents method for the new subscription.
GetEventsResults events = subscription.GetEvents();

// Handle the results of the GetEvents method.
foreach (ItemEvent itemEvent in events.ItemEvents)
{
switch (itemEvent.EventType)
{
case EventType.NewMail:
Console.WriteLine("New Mail");
EmailMessage message = EmailMessage.Bind(service, itemEvent.ItemId);
if (message.Subject.Equals(""))
{
break;
}
Item item = Item.Bind(service, itemEvent.ItemId);
RulesApplied(service, message, item);
break;
case EventType.Created:
Console.WriteLine("Created");
EmailMessage message1 = EmailMessage.Bind(service, itemEvent.ItemId);
// Here I get the Exception.
break;

最佳答案

我发现在设置下水印后邮箱所有者移动或删除邮件时会引发此异常。

我相信 ItemEvents 集合包含受订阅事件影响的项目(例如新消息),但并非集合中的所有项目仍然相关 - 例如ItemId 不再有效,因为它受到删除等后续事件的影响。

您可能会发现更频繁的轮询可以在最终用户触摸消息之前捕获该项目,但是在我组织内的应用程序中,我们只是记录异常,因为邮箱用户可能有特定原因移动或删除该项目订阅的应用程序对消息事件执行操作之前的消息。

关于exchangewebservices - "The specified object was not found in the store"异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19050938/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com