0

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

请求未通过架构验证:命名空间“http://schemas.microsoft.com/exchange/services/2006/types”中的元素“ForwardItem”在命名空间“ http://schemas.microsoft ”中具有无效的子元素“主题” 。 com/exchange/services/2006/types '。预期的可能元素列表:命名空间“ http://schemas.microsoft.com/exchange/services/2006/types ”中的“CcRecipients、BccRecipients、IsReadReceiptRequested、IsDeliveryReceiptRequested、From、ReferenceItemId、NewBodyContent ”

根据此链接,“主题”是“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>
4

1 回答 1

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>     

于 2017-07-10T08:50:40.067 回答