Я создал EWS-запрос на вложение электронного письма, но получил от него пустое значение, но получил статус «успешно».Кстати.
Сначала я создал запрос makeEwsRequestAsync для сохранения электронной почты в черновик, и он уже работает, но когда я пытаюсь добавить в него вложение, используя этот запрос, он не добавляет.Любые предложения или помощь, пожалуйста
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
function createAttachment() {
var request =
'<?xml version="1.0" encoding="utf-8"?>' +
'<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>' +
' <CreateAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
' <ParentItemId Id="'+itemID+'" />' +
' <Attachments>' +
' <t:ItemAttachment>' +
' <t:Name>Please</t:Name>' +
' <t:Message>' +
' <t:ItemClass>IPM>Note</t:ItemClass>' +
' <t:Subject>test</t:Subject>' +
' <t:Body BodyType="Text">my test</t:Body>' +
' </t:Message>' +
' </t:ItemAttachment>' +
' </Attachments>' +
' </CreateAttachment>' +
' </soap:Body>' +
'</soap:Envelope>';
return request;
}
</script>
Это мой запрос на создание приложения EWS
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
function composeMail(emailSubject, emailDescription) {
var subject= subjectPrefix + " " + emailSubject;
var request =
'<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
' xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"' +
' xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"' +
' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
' <soap:Header>' +
' <RequestServerVersion Version="Exchange2007_SP1" />' +
' </soap:Header>' +
' <soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
' <m:CreateItem MessageDisposition="SaveOnly">' +
' <m:SavedItemFolderId>' +
' <t:DistinguishedFolderId Id="drafts" />' +
' </m:SavedItemFolderId>' +
' <m:Items>' +
' <t:Message>' +
' <t:ItemClass>IPM.Note</t:ItemClass>' +
' <t:Subject>' + subject + '</t:Subject>' +
' <t:Body BodyType="HTML">' + emailDescription + '</t:Body>' +
' <t:Importance>Low</t:Importance>' +
' <t:ToRecipients>' +
' <t:Mailbox>' +
' <t:EmailAddress>' + recepient + '</t:EmailAddress>' +
' </t:Mailbox>' +
' </t:ToRecipients>' +
' <t:IsRead>false</t:IsRead>' +
' </t:Message>' +
' </m:Items>' +
' </m:CreateItem>' +
' </soap:Body>' +
'</soap:Envelope>';
return request;
}
</script>
Это мой запрос на создание электронной почты EWS
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
function send() {
var request =
'<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>' +
' <SendItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"' +
' SaveItemToFolder="true">' +
' <ItemIds>' +
' <t:ItemId Id="' + itemID + '"/>' +
' </ItemIds>' +
' </SendItem>' +
' </soap:Body>' +
'</soap:Envelope>';
return request;
}
</script>
Это мой запрос на отправку EWS, и я звоню им, используя
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
function sendRequest(emailSubject, emailDescription, emailItemID) {
// Create a local variable that contains the mailbox.
try {
itemID = Office.context.mailbox.item.itemId;
Office.context.mailbox.makeEwsRequestAsync(
composeMail(emailSubject, emailDescription), callbackCompose);
Office.context.mailbox.makeEwsRequestAsync(
createAttachment(), callbackAttachment);
Office.context.mailbox.makeEwsRequestAsync(
send(), callbackSend);
} catch (error) {
$("#id-error-msg").text(error);
}
</script>