尝试使用EWS CreateItem操作转发电子邮件时的架构验证错误

时间:2017-07-07 13:20:12

标签: exchange-server exchangewebservices exchange-server-2013

当我尝试使用EWS创建操作转发电子邮件时,我收到以下错误。

  

请求模式验证失败:元素'ForwardItem'中   名称空间'http://schemas.microsoft.com/exchange/services/2006/types'   在命名空间中具有无效的子元素“主题”   'http://schemas.microsoft.com/exchange/services/2006/types'。清单   可能的元素:'CcRecipients,BccRecipients,   IsReadReceiptRequested,IsDeliveryReceiptRequestedRequested,From,   ReferenceItemId,命名空间中的NewBodyContent'   'http://schemas.microsoft.com/exchange/services/2006/types'

根据此link'主题'是'ForwardItem'下的有效元素。我使用的是Exchange2013。对我做错了什么的想法?同样的请求适用于O365。

SOAP请求

<?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: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:Header>  
 <RequestServerVersion Version="Exchange2013" 
 xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
 soap:mustUnderstand="0" /> 
</soap:Header>
<soap:Body>  
  <m:CreateItem MessageDisposition="SendAndSaveCopy"> 
  <m:Items> 
  <t:ForwardItem>
  <t:ToRecipients>
  <t:Mailbox>                               
   <t:EmailAddress>admin@test.onmicrosoft.com</t:EmailAddress>
  </t:Mailbox>
  </t:ToRecipients>         
  <t:Subject>Email Submitted</t:Subject>   
  <t:ReferenceItemId Id="AQMkADJmMTI3Njk1LWZjOWItNDM2Os.."
   ChangeKey="CQAAABYAAAAmV1x/D6z5Q7lUEv1+KENlAAAAAACV"/>          
  <t:NewBodyContent BodyType="Text"></t:NewBodyContent>     
 </t:ForwardItem> 
 </m:Items> 
</m:CreateItem>
</soap:Body>
</soap:Envelope>

1 个答案:

答案 0 :(得分:1)

ForwardItem要求元素按照在架构中定义的顺序 - ForwardItem

尝试移动Subject上面的ToRecipients

<t:ForwardItem>
<t:Subject>Email Submitted</t:Subject> 
<t:ToRecipients>
<t:Mailbox>                               
 <t:EmailAddress>admin@test.onmicrosoft.com</t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>           
<t:ReferenceItemId Id="AQMkADJmMTI3Njk1LWZjOWItNDM2Os.."
 ChangeKey="CQAAABYAAAAmV1x/D6z5Q7lUEv1+KENlAAAAAACV"/>          
<t:NewBodyContent BodyType="Text"></t:NewBodyContent>