EmptyFolder operation
The EmptyFolder operation empties folders in a mailbox. Optionally, this operation enables you to delete the subfolders of the specified folder. When a subfolder is deleted, the subfolder and the messages within the subfolder are deleted.
EmptyFolder request example
Description
This following example of an EmptyFolder request shows how to form a request to empty a folder. This example deletes all subfolders of the identified folder.
Note
The values of the Id and the ChangeKey attributes of the FolderId element have been shortened for readability.
Code
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
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 ="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>
Comments
This example performs a hard delete on the folder.
Folders can be identified by either the DistinguishedFolderId element or the FolderId element for use in the FolderIds element.
Request elements
The following elements are used in the request:
Successful EmptyFolder response
Description
The following example shows a successful response to the EmptyFolder request.
Code
<?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="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns="https://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="https://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="https://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>
Successful response elements
The following elements are used in the response:
EmptyFolder error response
Description
The following example shows an error response to an Emptyfolder request. The error was created because the operation tried to empty a folder that was not found in the Exchange store.
Code
<?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="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns="https://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:GetFolderResponse
xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetFolderResponseMessage ResponseClass="Error">
<m:MessageText>Id is malformed.</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders />
</m:GetFolderResponseMessage>
</m:ResponseMessages>
</m:GetFolderResponse>
</s:Body>
</s:Envelope>
Error response elements
The following elements are used in the response:
See also
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기