CreateFolderPath 操作
查找有关 CreateFolderPath EWS 操作的信息。
CreateFolderPath 操作创建文件夹层次结构。
Exchange Server 2013 中引入了此操作。
使用 CreateFolderPath 操作
CreateFolderPath 操作请求采用文件夹数组和父文件夹标识符,并根据数组中文件夹的顺序创建文件夹层次结构。
CreateFolderPath 操作 SOAP 标头
CreateFolderPath 操作可以使用下表中列出的 SOAP 标头。
标头名称 | 元素 | 说明 |
---|---|---|
模拟 |
ExchangeImpersonation |
标识客户端应用程序正在模拟的用户。 此标头适用于请求。 |
MailboxCulture |
MailboxCulture |
标识要用于访问邮箱的区域性,如 RFC 3066“标识语言标记”中所述。 此标头适用于请求。 |
RequestVersion |
RequestServerVersion |
标识操作请求的架构版本。 此标头适用于请求。 |
ServerVersion |
ServerVersionInfo |
标识响应请求的服务器版本。 此标头适用于响应。 |
TimeZoneContext |
TimeZoneContext |
标识 DateTime 属性的时区范围。 此标头适用于请求。 |
CreateFolderPath 操作请求示例:创建文件夹层次结构
下面的 CreateFolderPath 操作请求示例演示如何创建一个文件夹层次结构,该层次结构位于默认“收件箱”文件夹中的三个文件夹。
注意
为了保持可读性,本文中的所有项标识符和更改键都已缩短。
<?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" />
<t:MailboxCulture>en-US</t:MailboxCulture>
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="GMT Standard Time"/>
</t:TimeZoneContext>
</soap:Header>
<soap:Body >
<m:CreateFolderPath>
<m:ParentFolderId>
<t:DistinguishedFolderId Id="inbox"/>
</m:ParentFolderId>
<m:RelativeFolderPath>
<t:Folder>
<t:DisplayName>MyFirstLevelFolder</t:DisplayName>
</t:Folder>
<t:Folder>
<t:DisplayName>MySecondLevelFolder</t:DisplayName>
</t:Folder>
<t:Folder>
<t:DisplayName>MyThirdLevelFolder</t:DisplayName>
</t:Folder>
</m:RelativeFolderPath>
</m:CreateFolderPath>
</soap:Body>
</soap:Envelope>
请求 SOAP 正文包含以下元素:
成功的 CreateFolderPath 操作响应
以下示例显示了对 CreateFolderPath 操作请求的成功响应,该操作请求在默认收件箱文件夹中创建文件夹层次结构三个文件夹。
<?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:CreateFolderPathResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderPathResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="AAMkADEzOTExYisXAAA=" ChangeKey="AQAAABYAABq6Wxb"/>
<t:DisplayName>MyFirstLevelFolder</t:DisplayName>
<t:TotalCount>0</t:TotalCount>
<t:ChildFolderCount>0</t:ChildFolderCount>
<t:UnreadCount>0</t:UnreadCount>
</t:Folder>
</m:Folders>
</m:CreateFolderPathResponseMessage>
<m:CreateFolderPathResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="AAMkADEzOTExm4QrAABqxisYAAA=" ChangeKey="AQAAABYAAAm4QrAABq6Wxg"/>
<t:DisplayName>MySecondLevelFolder</t:DisplayName>
<t:TotalCount>0</t:TotalCount>
<t:ChildFolderCount>0</t:ChildFolderCount>
<t:UnreadCount>0</t:UnreadCount>
</t:Folder>
</m:Folders>
</m:CreateFolderPathResponseMessage>
<m:CreateFolderPathResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="AAMkADEzOTAABqxisZAAA=" ChangeKey="AQAAABYAA6Wxl"/>
<t:DisplayName>MyThirdLevelFolder</t:DisplayName>
<t:TotalCount>0</t:TotalCount>
<t:ChildFolderCount>0</t:ChildFolderCount>
<t:UnreadCount>0</t:UnreadCount>
</t:Folder>
</m:Folders>
</m:CreateFolderPathResponseMessage>
</m:ResponseMessages>
</m:CreateFolderPathResponse>
</s:Body>
</s:Envelope>
响应 SOAP 正文包含以下元素:
CreateFolderPath 操作错误响应
以下示例显示了 对 CreateFolderPath 操作请求的错误响应。 这是对创建两个文件夹的请求的响应,其中第一个文件夹没有设置显示名称属性。 没有显示名称属性,无法创建层次结构中的第一个文件夹,并且无法创建第二个文件夹,因为层次结构中的父文件夹未创建。
<?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="556"
MinorBuildNumber="14"
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:CreateFolderPathResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderPathResponseMessage ResponseClass="Error">
<m:MessageText>The folder save operation failed due to invalid property values.</m:MessageText>
<m:ResponseCode>ErrorFolderSavePropertyError</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:MessageXml>
<t:FieldURI FieldURI="folder:DisplayName"/>
</m:MessageXml>
<m:Folders/>
</m:CreateFolderPathResponseMessage>
<m:CreateFolderPathResponseMessage ResponseClass="Error">
<m:MessageText>The specified parent folder could not be found.</m:MessageText>
<m:ResponseCode>ErrorParentFolderNotFound</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Folders/>
</m:CreateFolderPathResponseMessage>
</m:ResponseMessages>
</m:CreateFolderPathResponse>
</s:Body>
</s:Envelope>
错误响应 SOAP 正文包含以下元素:
有关 EWS 通用且特定于此操作的其他错误代码,请参阅 ResponseCode。