Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

4.4 Searching Mailboxes

This example of the SearchMailboxes operation, as defined in section 3.1.4.4, shows a request from the client to the server to search the specified mailboxes.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
          xmlns:m="http://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 (FYDIBOHF23SPDLT)/cn=Recipients/cn=35181a742f0e47e392c8201a60d13ecf-Steve</t:Mailbox>
                 <t:SearchScope>All</t:SearchScope>
               </t:MailboxSearchScope>
               <t:MailboxSearchScope>
                 <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=f00c9f70539844beb04001d8f40c572e-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 (FYDIBOHF23SPDLT)/cn=Recipients/cn=accba4fd5ddf4356b8a0e82ce1645f4e-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>

The server sends the following successful response to the client.

<?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="http://schemas.microsoft.com/exchange/services/2006/types" 
             xmlns="http://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="http://schemas.microsoft.com/exchange/services/2006/messages" 
                                 xmlns:t="http://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 FYDIBOHF23SPDLT)/cn=Recipients/cn=35181a742f0e47e392c8201a60d13ecf-Steve</t:Mailbox>
                           <t:SearchScope>All</t:SearchScope>
                       </t:MailboxSearchScope>
                       <t:MailboxSearchScope>
                         <t:Mailbox>/o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=f00c9f70539844beb04001d8f40c572e-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 (FYDIBOHF23SPDLT)/cn=Recipients/cn=accba4fd5ddf4356b8a0e82ce1645f4e-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>
Show:
© 2014 Microsoft. All rights reserved.