4 Protocol Examples

Example XML for FindFolders operation.

 Request XML:
 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://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:FindFolder Traversal="Deep">
       <m:FolderShape>
         <t:BaseShape>IdOnly</t:BaseShape>
         <t:AdditionalProperties>
           <t:FieldURI FieldURI="folder:DisplayName" />
         </t:AdditionalProperties>
       </m:FolderShape>
       <m:IndexedPageFolderView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" />
       <m:Restriction>
         <t:And>
           <t:Contains ContainmentMode="Substring" ContainmentComparison="IgnoreCase">
             <t:FieldURI FieldURI="folder:DisplayName" />
             <t:Constant Value="value1" />
           </t:Contains>
           <t:Contains ContainmentMode="Prefixed" ContainmentComparison="IgnoreCase">
             <t:FieldURI FieldURI="folder:FolderClass" />
             <t:Constant Value="IPF.Note" />
           </t:Contains>
           <t:IsGreaterThan>
             <t:FieldURI FieldURI="folder:TotalCount" />
             <t:FieldURIOrConstant>
               <t:Constant Value="0" />
             </t:FieldURIOrConstant>
           </t:IsGreaterThan>
         </t:And>
       </m:Restriction>
       <m:ParentFolderIds>
         <t:DistinguishedFolderId Id="root" />
       </m:ParentFolderIds>
     </m:FindFolder>
   </soap:Body>
 </soap:Envelope>
  
 Response XML:
 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header><h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="31" MinorBuildNumber="0" Version="V2_27" 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:FindFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
       <m:ResponseMessages>
         <m:FindFolderResponseMessage ResponseClass="Success">
           <m:ResponseCode>
             NoError
           </m:ResponseCode>
             <m:RootFolder IndexedPagingOffset="1" TotalItemsInView="1" IncludesLastItemInRange="true">
               <t:Folders>
                 <t:Folder>
                   <t:FolderId Id="AAMkADNkNzE5Nzg3LTRlN" ChangeKey="AQAAABQAAAAWi/oZ5g6xAMTqA=="/>
                   <t:DisplayName>
                     E15 Dogfood
                   </t:DisplayName>
                 </t:Folder>
               </t:Folders>
             </m:RootFolder>
         </m:FindFolderResponseMessage>
       </m:ResponseMessages>
     </m:FindFolderResponse>
   </s:Body>
 </s:Envelope>
  

Example XML for FindItem operation:

 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
     <t:RequestServerVersion Version="Exchange2010" />
   </soap:Header>
   <soap:Body>
     <m:FindItem Traversal="Shallow">
       <m:ItemShape>
         <t:BaseShape>IdOnly</t:BaseShape>
         <t:AdditionalProperties>
           <t:FieldURI FieldURI="item:Subject" />
           <t:FieldURI FieldURI="item:DateTimeReceived" />
           <t:FieldURI FieldURI="message:Sender" />
         </t:AdditionalProperties>
       </m:ItemShape>
       <m:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" />
       <m:GroupBy Order="Descending">
         <t:FieldURI FieldURI="item:Subject" />
         <t:AggregateOn Aggregate="Maximum">
           <t:FieldURI FieldURI="item:DateTimeReceived" />
         </t:AggregateOn>
       </m:GroupBy>
       <m:Restriction>
         <t:IsEqualTo>
           <t:FieldURI FieldURI="item:ItemClass" />
           <t:FieldURIOrConstant>
             <t:Constant Value="IPM.Note" />
           </t:FieldURIOrConstant>
         </t:IsEqualTo>
       </m:Restriction>
       <m:SortOrder>
         <t:FieldOrder Order="Ascending">
           <t:FieldURI FieldURI="item:DateTimeReceived" />
         </t:FieldOrder>
       </m:SortOrder>
       <m:ParentFolderIds>
         <t:DistinguishedFolderId Id="inbox" />
       </m:ParentFolderIds>
     </m:FindItem>
   </soap:Body>
 </soap:Envelope>

Following example shows the XML that is returned with FindItems operation. The ItemId and ChangeKey attributes have been shortened to preserve readability. In this example, there are three groups in this 10-item response.

 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
     <h:ServerVersionInfo MajorVersion="14" 
        MinorVersion="0" 
        MajorBuildNumber="639" 
        MinorBuildNumber="20" 
        Version="Exchange2010" 
        xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
        xmlns="http://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
          xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
       <m:ResponseMessages>
         <m:FindItemResponseMessage ResponseClass="Success">
           <m:ResponseCode>NoError</m:ResponseCode>
           <m:RootFolder IndexedPagingOffset="13" TotalItemsInView="26" IncludesLastItemInRange="false">
             <t:Groups>
               <t:GroupedItems>
                 <t:GroupIndex>Testing</t:GroupIndex>
                 <t:Items>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T16:31:42Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserTwo</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T16:31:50Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserTwo</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:44:25Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserOne</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:45:02Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserOne</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:48:02Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserOne</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Testing</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:48:23Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserOne</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                 </t:Items>
               </t:GroupedItems>
               <t:GroupedItems>
                 <t:GroupIndex>Over there</t:GroupIndex>
                 <t:Items>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Over there</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:43:34Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserOne</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Over there</t:Subject>
                     <t:DateTimeReceived>2009-10-14T19:45:47Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserTwo</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                 </t:Items>
               </t:GroupedItems>
               <t:GroupedItems>
                 <t:GroupIndex>Interesting</t:GroupIndex>
                 <t:Items>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Interesting</t:Subject>
                     <t:DateTimeReceived>2009-10-02T22:02:18Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserTwo</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                   <t:Message>
                     <t:ItemId Id="AQMkAGEyYzQ" ChangeKey="CQAAABYAAA" />
                     <t:Subject>Interesting</t:Subject>
                     <t:DateTimeReceived>2009-10-05T20:10:11Z</t:DateTimeReceived>
                     <t:Sender>
                       <t:Mailbox>
                         <t:Name>E14UserTwo</t:Name>
                         <t:MailboxType>OneOff</t:MailboxType>
                       </t:Mailbox>
                     </t:Sender>
                   </t:Message>
                 </t:Items>
               </t:GroupedItems>
             </t:Groups>
           </m:RootFolder>
         </m:FindItemResponseMessage>
       </m:ResponseMessages>
     </m:FindItemResponse>
   </s:Body>
 </s:Envelope>