0

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

请求失败架构验证:元素“ForwardItem”在 命名空间“http://schemas.microsoft.com/exchange/services/2006/types” 在命名空间 “http://schemas.microsoft.com/exchange/services/2006/types”无效的子元素“主题”。预计 可能元素列表: 'CcRecipients,BccRecipients, IsReadReceiptRequested,IsDeliveryReceiptRequested,从, 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>[email protected]</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

ForwardItem要求元素是在它们在模式中定义的顺序 - ForwardItem

尝试移动Subject上述ToRecipients

<t:ForwardItem> 
<t:Subject>Email Submitted</t:Subject> 
<t:ToRecipients> 
<t:Mailbox>        
<t:EmailAddress>[email protected]</t:EmailAddress> 
</t:Mailbox> 
</t:ToRecipients>   
<t:ReferenceItemId Id="AQMkADJmMTI3Njk1LWZjOWItNDM2Os.." 
ChangeKey="CQAAABYAAAAmV1x/D6z5Q7lUEv1+KENlAAAAAACV"/>   
<t:NewBodyContent BodyType="Text"></t:NewBodyContent>  

+0

非常感谢。它正在工作。不知道元素的顺序在SOAP请求中很重要。 – bala

相关问题