Operação SearchMailboxesSearchMailboxes operation

Observação

Essa operação foi preterida e não tem mais suporte da Microsoft.This operation is deprecated, and no longer supported by Microsoft. Como substituição, use a operação FindItem .As a replacement, please use the FindItem operation.

Encontre informações sobre a operação do EWS do SearchMailboxes .Find information about the SearchMailboxes EWS operation.

A operação SearchMailboxes pesquisa caixas de correio para ocorrências de termos em itens de caixa de correio.The SearchMailboxes operation searches mailboxes for occurrences of terms in mailbox items.

This operation was introduced in Exchange Server 2013.This operation was introduced in Exchange Server 2013.

Usando a operação SearchMailboxesUsing the SearchMailboxes operation

A operação SearchMailboxes pode usar muitas consultas de pesquisa simultâneas para executar a pesquisa de descoberta em várias caixas de correio.The SearchMailboxes operation can use many simultaneous search queries to perform discovery search on multiple mailboxes. Os resultados podem ser informações estatísticas sobre o número de vezes que os termos de pesquisa ocorrem ou uma visualização dos itens que contêm os termos da pesquisa.The results can be either statistical information about the number of times search terms occur, or a preview of the items that contain the search terms.

Cabeçalhos SOAP de operação SearchMailboxesSearchMailboxes operation SOAP headers

A operação SearchMailboxes pode usar os cabeçalhos SOAP listados na tabela a seguir.The SearchMailboxes operation can use the SOAP headers that are listed in the following table.

Nome de cabeçalhoHeader name ElementoElement DescriçãoDescription
ManagementRoleManagementRole
ManagementRoleManagementRole
Identifica as funções de servidor necessárias para que o chamador faça a solicitação.Identifies the server roles that are necessary in order for the caller to make the request. Este cabeçalho é aplicável a uma solicitação.This header is applicable to a request.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
Identifica a versão do esquema para a solicitação de operação.Identifies the schema version for the operation request. Este cabeçalho é aplicável a uma solicitação.This header is applicable to a request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
Identifica a versão do servidor que respondeu à solicitação.Identifies the version of the server that responded to the request. Este cabeçalho é aplicável a uma resposta.This header is applicable to a response.

Exemplo de solicitação de operação SearchMailboxes: Pesquisar caixas de correio para o número de acertos de termos de pesquisaSearchMailboxes operation request example: Search mailboxes for number of search term hits

O exemplo a seguir de uma solicitação de operação SearchMailboxes mostra como usar duas consultas diferentes para pesquisar três caixas de correio diferentes para obter informações estatísticas sobre quantas vezes um termo aparece em cada caixa de correio.The following example of a SearchMailboxes operation request shows how to use two different queries to search three different mailboxes for statistical information about how many times a term appears in each mailbox.

Observação

Neste exemplo, o elemento de consulta é intencionalmente deixado em branco.In this example, the Query element is intentionaly left blank. Isso mostra como uma solicitação bem-sucedida pode conter condições de erro em uma base de pesquisa por caixa de correio.This shows how a successful request can contain error conditions on a per mailbox search basis.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
   <soap:Header>
      <t:RequestServerVersion Version="Exchange2013" />
   </soap:Header>
   <soap:Body >
      <m:SearchMailboxes>
         <m:SearchQueries>
            <t:MailboxQuery>
               <t:Query>Test Item</t:Query>
               <t:MailboxSearchScopes>
                  <t:MailboxSearchScope>
                     <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYDLT)/cn=Recipients/cn=12311a742f0e47e392c8201a60d13ecf-Steve</t:Mailbox>
                     <t:SearchScope>All</t:SearchScope>
                  </t:MailboxSearchScope>
                  <t:MailboxSearchScope>
                     <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYDLT)/cn=Recipients/cn=f00c9f70539844beb52341d8f40c572e-Antho</t:Mailbox>
                     <t:SearchScope>PrimaryOnly</t:SearchScope>
                  </t:MailboxSearchScope>
               </t:MailboxSearchScopes>
            </t:MailboxQuery>
            <t:MailboxQuery>
               <t:Query></t:Query>
               <t:MailboxSearchScopes>
                  <t:MailboxSearchScope>
                     <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYDLT)/cn=Recipients/cn=accba4fd5ddf12214a0e82ce1645f4e-Danie</t:Mailbox>
                     <t:SearchScope>ArchiveOnly</t:SearchScope>
                  </t:MailboxSearchScope>
               </t:MailboxSearchScopes>
            </t:MailboxQuery>
         </m:SearchQueries>
         <m:ResultType>StatisticsOnly</m:ResultType>
      </m:SearchMailboxes>
   </soap:Body>
</soap:Envelope>

O corpo SOAP de solicitação contém os seguintes elementos:The request SOAP body contains the following elements:

Resposta de operação SearchMailboxes bem-sucedidaSuccessful SearchMailboxes operation response

O exemplo a seguir mostra uma resposta bem-sucedida a uma solicitação de operação SearchMailboxes para obter informações estatísticas sobre o número de vezes que os termos de pesquisa são encontrados nas caixas de correio de destino.The following example shows a successful response to a SearchMailboxes operation request to get statistical information about the number of times search terms are found in the target mailboxes. A última consulta contém um elemento de consulta vazio, que mostra uma pesquisa de caixa de correio com falha.The last query contains an empty Query element, which shows a failed mailbox search.

<?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="526" 
                           MinorBuildNumber="0" 
                           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:SearchMailboxesResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                                 xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:SearchMailboxesResponseMessage ResponseClass="Success">
               <m:ResponseCode>NoError</m:ResponseCode>
               <m:SearchMailboxesResult>
                  <t:SearchQueries>
                     <t:MailboxQuery>
                        <t:Query>Test Item</t:Query>
                        <t:MailboxSearchScopes>
                           <t:MailboxSearchScope>
                              <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYPDLT)/cn=Recipients/cn=35181a94327e392c8201a60d13ecf-Steve</t:Mailbox>
                              <t:SearchScope>All</t:SearchScope>
                           </t:MailboxSearchScope>
                           <t:MailboxSearchScope>
                              <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYPDLT)/cn=Recipients/cn=f00c9f789572-beb04001d8f40c572e-Antho</t:Mailbox>
                              <t:SearchScope>PrimaryOnly</t:SearchScope>
                           </t:MailboxSearchScope>
                        </t:MailboxSearchScopes>
                     </t:MailboxQuery>
                  </t:SearchQueries>
                  <t:ResultType>StatisticsOnly</t:ResultType>
                  <t:ItemCount>2</t:ItemCount>
                  <t:Size>20206</t:Size>
                  <t:PageItemCount>0</t:PageItemCount>
                  <t:PageItemSize>0</t:PageItemSize>
                  <t:KeywordStats>
                     <t:KeywordStat>
                        <t:Keyword>Test Item</t:Keyword>
                        <t:ItemHits>2</t:ItemHits>
                        <t:Size>20206</t:Size>
                     </t:KeywordStat>
                  </t:KeywordStats>
                  <t:FailedMailboxes>
                     <t:FailedMailbox>
                        <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYPDLT)/cn=Recipients/cn=accba4as3df234234a0e82ce1645f4e-Danie</t:Mailbox>
                        <t:ErrorCode>0</t:ErrorCode>
                        <t:ErrorMessage>The search query can't be empty.</t:ErrorMessage>
                        <t:IsArchive>true</t:IsArchive>
                     </t:FailedMailbox>
                  </t:FailedMailboxes>
               </m:SearchMailboxesResult>
            </m:SearchMailboxesResponseMessage>
         </m:ResponseMessages>
      </m:SearchMailboxesResponse>
   </s:Body>
</s:Envelope>

O corpo SOAP de resposta contém os seguintes elementos:The response SOAP body contains the following elements:

Resposta de erro de operação SearchMailboxesSearchMailboxes operation error response

O exemplo a seguir mostra uma resposta de erro a uma solicitação de operação SearchMailboxes .The following example shows an error response to a SearchMailboxes operation request. Esta é uma resposta a uma solicitação de pesquisa de uma caixa de correio quando o identificador de caixa de correio está incorreto.This is a response to a request to search a mailbox when the mailbox identifier is incorrect.

<?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="526" 
                           MinorBuildNumber="0" 
                           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:SearchMailboxesResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                                 xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
         <m:ResponseMessages>
            <m:SearchMailboxesResponseMessage ResponseClass="Error">
               <m:MessageText>No mailbox is specified for search operation. If specified in the request, 
               then it could be due to permission issue.</m:MessageText>
               <m:ResponseCode>ErrorInvalidOperation</m:ResponseCode>
               <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
               <m:SearchMailboxesResult>
                  <t:SearchQueries>
                     <t:MailboxQuery>
                        <t:Query>subject:Test Item</t:Query>
                        <t:MailboxSearchScopes>
                           <t:MailboxSearchScope>
                              <t:Mailbox>sbrown@contoso.com</t:Mailbox>
                              <t:SearchScope>All</t:SearchScope>
                           </t:MailboxSearchScope>
                        </t:MailboxSearchScopes>
                     </t:MailboxQuery>
                  </t:SearchQueries>
                  <t:ResultType>StatisticsOnly</t:ResultType>
                  <t:ItemCount>0</t:ItemCount>
                  <t:Size>0</t:Size>
                  <t:PageItemCount>0</t:PageItemCount>
                  <t:PageItemSize>0</t:PageItemSize>
                  <t:FailedMailboxes>
                     <t:FailedMailbox>
                        <t:Mailbox>sbrown@contoso.com</t:Mailbox>
                        <t:ErrorCode>0</t:ErrorCode>
                        <t:ErrorMessage>No mailbox is specified for search operation. If specified in the request, 
                        then it could be due to permission issue.</t:ErrorMessage>
                        <t:IsArchive>false</t:IsArchive>
                     </t:FailedMailbox>
                  </t:FailedMailboxes>
               </m:SearchMailboxesResult>
            </m:SearchMailboxesResponseMessage>
         </m:ResponseMessages>
      </m:SearchMailboxesResponse>
   </s:Body>
</s:Envelope>

O corpo SOAP de resposta de erro contém os seguintes elementos:The error response SOAP body contains the following elements:

Para obter códigos de erro adicionais genéricos para o EWS e específicos para essa operação, consulte ResponseCode.For additional error codes that are generic to EWS and specific to this operation, see ResponseCode.

Confira tambémSee also