4.4 EmptyFolder Operation

The following is an example of an EmptyFolder operation with the EmptyFolderType complex type.

The client constructs the request XML and sends it to the server. This example of an EmptyFolder operation request shows how to form a request to empty a folder. This example deletes all subfolders of the identified folder.

The FolderId element Id and ChangeKey attributes have been shortened to preserve readability.

 <?xml version="1.0" encoding="utf-8" ?>
 <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                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 ="Exchange2010_SP1"/>
     </soap:Header>
     <soap:Body>
       <m:EmptyFolder DeleteType="HardDelete" DeleteSubFolders="true">
         <m:FolderIds>
           <t:FolderId Id="AQMkADhhOGU0"  ChangeKey="AQAAABYAAABsMB" />
         </m:FolderIds>
       </m:EmptyFolder>
     </soap:Body>
 </soap:Envelope>
  

The server constructs the response XML and sends it 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="14" 
                          MinorVersion="1" 
                          MajorBuildNumber="164" 
                          MinorBuildNumber="0" 
                          Version="Exchange2010_SP1"
                          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:EmptyFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
                            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
       <m:ResponseMessages>
         <m:EmptyFolderResponseMessage ResponseClass="Success">
           <m:ResponseCode>NoError</m:ResponseCode>
         </m:EmptyFolderResponseMessage>
       </m:ResponseMessages>
     </m:EmptyFolderResponse>
   </s:Body>
 </s:Envelope>
  
Show: