4.2 CreateFolder Operation
The following is an example of a CreateFolder operation with the CreateFolderType complex type.
The client constructs the request XML and sends it to the server. A new folder named Custom Folder is created in the Inbox. If the newly created folder already exists within the specified parent folder, an error is thrown.
-
<?xml version="1.0" encoding="utf-8"?> <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:CreateFolder> <m:ParentFolderId> <t:DistinguishedFolderId Id="inbox" /> </m:ParentFolderId> <m:Folders> <t:Folder> <t:FolderClass>IPF.MyCustomFolderClass</t:FolderClass> <t:DisplayName>Custom Folder</t:DisplayName> <t:PermissionSet> <t:Permissions /> </t:PermissionSet> </t:Folder> </m:Folders> </m:CreateFolder> </soap:Body> </soap:Envelope>
The server constructs the response XML and sends it to the client. The FolderId element Id and ChangeKey attributes have been shortened to preserve readability.
-
<?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="63" MinorBuildNumber="0" 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:CreateFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <m:ResponseMessages> <m:CreateFolderResponseMessage ResponseClass="Success"> <m:ResponseCode>NoError</m:ResponseCode> <m:Folders> <t:Folder> <t:FolderId Id="AAMkAGIwODEy" ChangeKey="AQAAABYAAA " /> </t:Folder> </m:Folders> </m:CreateFolderResponseMessage> </m:ResponseMessages> </m:CreateFolderResponse> </s:Body> </s:Envelope>