MarkAllItemsAsRead 操作

查找有关 MarkAllItemsAsRead EWS 操作的信息。

MarkAllItemsAsRead 操作设置一个或多个文件夹中所有项的 IsRead 属性,以指示所有项目都是已读或未读的。

Exchange Server 2013 中引入了此操作。

使用 MarkAllItemsAsRead 操作

MarkAllItemsAsRead 操作可以对由 Exchange Web Services (EWS 标识的文件夹中的所有项目设置 IsRead 属性) 文件夹标识符或默认 Exchange 文件夹名称。 MarkAllItemsAsRead 操作还可以禁止发送标记为已读项目的已读回执。

MarkAllItemsAsRead 操作 SOAP 标头

MarkAllItemsAsRead 操作可以使用下表中列出的 SOAP 标头。

标头名称 元素 说明
模拟
ExchangeImpersonation
标识客户端应用程序正在模拟的用户。 此标头适用于请求。
MailboxCulture
MailboxCulture
标识要用于访问邮箱的区域性,如 RFC 3066“标识语言标记”中所述。 此标头适用于请求。
RequestVersion
RequestServerVersion
标识操作请求的架构版本。 此标头适用于请求。
ServerVersion
ServerVersionInfo
标识响应请求的服务器版本。 此标头适用于响应。

MarkAllItemsAsRead 操作请求示例:将文件夹中的所有项目标记为已读

下面的 MarkAllItemsAsRead 操作请求示例演示如何在文件夹中的所有项目上将 IsRead 属性(也称为读取标志)设置为 true 。 此示例还显示,未发送已读回执以响应任何已读回执请求。

注意

为了保持可读性,本文中的所有项标识符和更改键都已缩短。 此操作不需要更改密钥。

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2013" />
   </soap:Header>
   <soap:Body>
      <m:MarkAllItemsAsRead>
         <m:ReadFlag>true</m:ReadFlag>
         <m:SuppressReadReceipts>true</m:SuppressReadReceipts>
         <m:FolderIds>
            <t:FolderId Id="AAMkADEzOTExYZRAAA=" 
                        ChangeKey="AQAAAAA3vA==" />
         </m:FolderIds>
      </m:MarkAllItemsAsRead>
   </soap:Body>
</soap:Envelope>

请求 SOAP 正文包含以下元素:

成功的 MarkAllItemsAsRead 操作响应

以下示例显示了对 MarkAllItemsAsRead 操作请求的成功响应,该请求将文件夹中的所有项目标记为已读。

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15" 
                           MinorVersion="0" 
                           MajorBuildNumber="545" 
                           MinorBuildNumber="11" 
                           Version="Exchange2013" 
                           xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:MarkAllItemsAsReadResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                                    xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:MarkAllItemsAsReadResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
            </m:MarkAllItemsAsReadResponseMessage>
         </m:ResponseMessages>
      </m:MarkAllItemsAsReadResponse>
   </s:Body>
</s:Envelope>

响应 SOAP 正文包含以下元素:

MarkAllItemsAsRead 操作请求示例:将文件夹中的所有项目标记为未读

下面的 MarkAllItemsAsRead 操作请求示例演示如何在文件夹中的所有项目上将 IsRead 属性设置为 false 。 此示例还显示,未发送已读回执以响应任何已读回执请求。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2013" />
   </soap:Header>
   <soap:Body>
      <m:MarkAllItemsAsRead>
         <m:ReadFlag>false</m:ReadFlag>
         <m:SuppressReadReceipts>true</m:SuppressReadReceipts>
         <m:FolderIds>
            <t:FolderId Id="AAMkADEzOTExYZRAAA=" 
                        ChangeKey="AQAAAAA3vA==" />
         </m:FolderIds>
      </m:MarkAllItemsAsRead>
   </soap:Body>
</soap:Envelope>

对将所有项目标记为已读的请求的成功响应与对所有项目标记为未读的请求的响应相同。

请求 SOAP 正文包含以下元素:

MarkAllItemsAsRead 操作错误响应

以下示例显示了 对 MarkAllItemsAsRead 操作请求的错误响应,该请求在邮箱中不存在文件夹时将文件夹中的所有项目标记为已读或未读。

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ServerVersionInfo MajorVersion="15" 
                           MinorVersion="0" 
                           MajorBuildNumber="545" 
                           MinorBuildNumber="11" 
                           Version="Exchange2013" 
                           xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <m:MarkAllItemsAsReadResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                                    xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:MarkAllItemsAsReadResponseMessage 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:MarkAllItemsAsReadResponseMessage>
         </m:ResponseMessages>
      </m:MarkAllItemsAsReadResponse>
   </s:Body>
</s:Envelope>

错误响应 SOAP 正文包含以下元素:

另请参阅