我想使用带有ForwardItem元素的CreateItem将一些文本附加到我要转发的电子邮件正文的开头(通过Web Mail Addin / JavaScript for Office)。我插入的文本很复杂,似乎会生成各种ErrorSchemaValidation错误。这是我尝试过的NewBodyContent元素的值(BodyType =“HTML”;正文通过headers参数传递):
<user@domain.com>
“)<H1>
Hello world!</H1>
” - 失败,未附加任何文字我很困惑。关于如何正确地将复杂文本附加到HTML正文的任何想法?
function forwardItemRequest(item_id, email, changeKey, headers) {
var request;
// The following string is a valid SOAP envelope and request for forwarding
// a mail item. Note that we use the item_id value to specify the item we are interested in,
// along with its ChangeKey value that we have just determined
// We also provide the XML fragment to specify the recipient addresses
//TEST 5: Try with HTML content
request = '<?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>' + email + '</t:ToRecipients>' +
' <t:ReferenceItemId Id="' + item_id + '" ChangeKey="' + changeKey + '" />' +
' <t:NewBodyContent BodyType="HTML">' + headers + '</t:NewBodyContent>' +
' </t:ForwardItem>' +
' </m:Items>' +
' </m:CreateItem>' +
' </soap:Body>' +
'</soap:Envelope>';
return request;
}