MarkAllItemsAsRead 操作MarkAllItemsAsRead operation

查找有关MarkAllItemsAsRead EWS 操作的信息。Find information about the MarkAllItemsAsRead EWS operation.

MarkAllItemsAsRead操作设置一个或多个文件夹中所有项目的IsRead属性,以指示所有项目都已读或未读。The MarkAllItemsAsRead operation sets the IsRead property on all items, in one or more folders, to indicate that all items are either read or unread.

Exchange Server 2013 中引入了此操作。This operation was introduced in Exchange Server 2013.

使用 MarkAllItemsAsRead 操作Using the MarkAllItemsAsRead operation

MarkAllItemsAsRead操作可以设置文件夹中的所有项目的IsRead属性,这些项目由 EXCHANGE Web 服务(EWS)文件夹标识符或默认 Exchange 文件夹名称标识。The MarkAllItemsAsRead operation can set the IsRead property on all items in folders identified by either the Exchange Web Services (EWS) folder identifier or the default Exchange folder name. MarkAllItemsAsRead操作还可以禁止发送标记为 "已读" 的项目的已读回执。The MarkAllItemsAsRead operation can also suppress the sending of read receipts for items marked as read.

MarkAllItemsAsRead 操作 SOAP 标头MarkAllItemsAsRead operation SOAP headers

MarkAllItemsAsRead操作可以使用下表中列出的 SOAP 标头。The MarkAllItemsAsRead operation can use the SOAP headers that are listed in the following table.

标头名称Header name 元素Element 说明Description
模拟Impersonation
ExchangeImpersonationExchangeImpersonation
标识客户端应用程序模拟的用户。Identifies the user whom the client application is impersonating. 此标头适用于请求。This header is applicable to a request.
MailboxCultureMailboxCulture
MailboxCultureMailboxCulture
确定用于访问邮箱的区域性(如 RFC 3066 中定义的用于标识语言的标记)。Identifies the culture, as defined in RFC 3066, "Tags for the Identification of Languages", to be used to access the mailbox. 此标头适用于请求。This header is applicable to a request.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
标识操作请求的架构版本。Identifies the schema version for the operation request. 此标头适用于请求。This header is applicable to a request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request. 此标头适用于响应。This header is applicable to a response.

MarkAllItemsAsRead 操作请求示例:将文件夹中的所有项目标记为已读MarkAllItemsAsRead operation request example: Mark all items in a folder as read

以下示例的MarkAllItemsAsRead操作请求显示如何将文件夹中所有项目的IsRead属性(也称为 "读取" 标志)设置为trueThe following example of a MarkAllItemsAsRead operation request shows how to set the IsRead property, which is also called the read flag, to true on all items in a folder. 此示例还显示了在响应任何已读回执请求时不会发送 "已读" 回执。This example also shows that read receipts are not sent in response to any read receipt requests.

备注

本文中的所有项目标识符和更改密钥都已缩短,以保持可读性。All item identifiers and change keys in this article have been shortened to preserve readability. 此操作不需要更改键。Change keys are not required for this operation.

<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 正文包含以下元素:The request SOAP body contains the following elements:

成功的 MarkAllItemsAsRead 操作响应Successful MarkAllItemsAsRead operation response

下面的示例演示对MarkAllItemsAsRead操作请求的成功响应,以将文件夹中的所有项目标记为已读。The following example shows a successful response to a MarkAllItemsAsRead operation request to mark all items in a folder as read.

<?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 正文包含以下元素:The response SOAP body contains the following elements:

MarkAllItemsAsRead 操作请求示例:将文件夹中的所有项目标记为未读MarkAllItemsAsRead operation request example: Mark all items in a folder as unread

下面的MarkAllItemsAsRead操作请求示例演示如何在文件夹中的所有项目上将IsRead属性设置为falseThe following example of a MarkAllItemsAsRead operation request shows how to set the IsRead property to false on all items in a folder. 此示例还显示了在响应任何已读回执请求时不会发送 "已读" 回执。This example also shows that read receipts are not sent in response to any read receipt requests.

<?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>

对将所有项目标记为已读的请求的成功响应与对将所有项目标记为未读的请求的响应相同。A successful response to a request to mark all items as read is the same as the response to a request to mark all items as unread.

请求 SOAP 正文包含以下元素:The request SOAP body contains the following elements:

MarkAllItemsAsRead 操作错误响应MarkAllItemsAsRead operation error response

下面的示例演示对MarkAllItemsAsRead操作请求的错误响应,以便将文件夹中的所有项目标记为已读或未读(当该文件夹在邮箱中不存在时)。The following example shows an error response to a MarkAllItemsAsRead operation request to mark all items in a folder as read or unread when the folder does not exist in the mailbox.

<?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 正文包含以下元素:The error response SOAP body contains the following elements:

另请参阅See also