CreateItem 操作(联系人)
CreateItem 操作用于在 Exchange 存储中创建联系人。
说明
不支持创建专用分发列表。 CompleteName 容器中的所有属性都是只读的,不能在联系人项上设置。
CreateItem 请求示例
说明
以下有效的 CreateItem SOAP 请求示例演示如何在默认联系人文件夹中创建联系人。
代码
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<soap:Body>
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" >
<SavedItemFolderId>
<t:DistinguishedFolderId Id="contacts"/>
</SavedItemFolderId>
<Items>
<t:Contact>
<t:FileAs>SampleContact</t:FileAs>
<t:GivenName>Tanja</t:GivenName>
<t:CompanyName>Blue Yonder Airlines</t:CompanyName>
<t:EmailAddresses>
<t:Entry Key="EmailAddress1">tplate@example.com</t:Entry>
</t:EmailAddresses>
<t:PhysicalAddresses>
<t:Entry Key="Business">
<t:Street>1234 56th Ave</t:Street>
<t:City>La Habra</t:City>
<t:State>CA</t:State>
<t:CountryOrRegion>USA</t:CountryOrRegion>
</t:Entry>
</t:PhysicalAddresses>
<t:PhoneNumbers>
<t:Entry Key="BusinessPhone">4255550199</t:Entry>
</t:PhoneNumbers>
<t:JobTitle>Manager</t:JobTitle>
<t:Surname>Plate</t:Surname>
</t:Contact>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>
请求元素
响应中使用了以下元素:
CreateItem 请求成功
说明
以下示例演示对创建联系人的 CreateItem 请求的成功响应。 在此示例中,响应包含新创建项的标识符。
代码
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="602" MinorBuildNumber="0"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Contact>
<t:ItemId Id="AAAtA=" ChangeKey="EQAAAB" />
</t:Contact>
</m:Items>
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</CreateItemResponse>
</soap:Body>
</soap:Envelope>
备注
已缩短项标识符以保留可读性。
成功的响应元素
响应中使用了以下元素:
CreateItem 请求示例无效
说明
以下示例演示包含有效 XML 但不兼容指令的请求。 无法在搜索文件夹中创建联系人。
代码
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<soap:Body>
<CreateItem xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>
<SavedItemFolderId>
<t:DistinguishedFolderId Id='searchfolders'/>
</SavedItemFolderId>
<Items>
<t:Contact>
<t:ItemClass>IPM.Contact</t:ItemClass>
</t:Contact>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>
CreateItem (联系人) 错误响应
说明
以下示例演示对 CreateItem (联系人) 请求的错误响应。
代码
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="602" MinorBuildNumber="0"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Error">
<m:MessageText>Cannot create a contact in a non-contact Folder.</m:MessageText>
<m:ResponseCode>ErrorCannotCreateContactInNonContactFolder</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items />
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</CreateItemResponse>
</soap:Body>
</soap:Envelope>
错误响应元素
错误响应中使用了以下元素: