Office.DecryptedMessageBody interface
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
表示已解密消息的正文。
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
若要了解如何在 Outlook 中开发加密加载项,请参阅 创建加密 Outlook 加载项。
示例
// This sample handles the OnMessageRead event to decrypt the body and attachments of a message.
function onMessageReadHandler(event) {
// Your code to decrypt the contents of a message would appear here.
...
// Use the results from your decryption process to display the decrypted contents of the message body and attachments.
const decryptedBodyContent = "<p>Please find attached the recent report and its supporting documentation.</p>";
const decryptedBody = {
coercionType: Office.CoercionType.Html,
content: decryptedBodyContent
};
// Decrypted content and properties of a file attachment.
const decryptedPdfFile = "JVBERi0xLjQKJeLjz9MKNCAwIG9i...";
const pdfFileName = "Fabrikam_Report_202509";
// Decrypted content and properties of a mail item.
const decryptedEmailFile = "VGhpcyBpcyBhIHRleHQgZmlsZS4=...";
const emailFileName = "Fabrikam_Report_202508.eml";
// Decrypted properties of a cloud attachment.
const cloudFilePath = "https://contosostorage.com/reports/weekly_forecast.xlsx";
const cloudFileName = "weekly_forecast.xlsx";
// Decrypted content and properties of an inline image.
const decryptedImageFile = "iVBORw0KGgoAAAANSUhEUgAA...";
const imageFileName = "banner.png";
const imageContentId = "image001.png@01DC1DD9.1A4AA300";
const decryptedAttachments = [
{
attachmentType: Office.MailboxEnums.AttachmentType.File,
content: decryptedPdfFile,
isInline: false,
name: pdfFileName
},
{
attachmentType: Office.MailboxEnums.AttachmentType.Item,
content: decryptedEmailFile,
isInline: false,
name: emailFileName
},
{
attachmentType: Office.MailboxEnums.AttachmentType.Cloud,
isInline: false,
name: cloudFileName,
path: cloudFilePath
},
{
attachmentType: Office.MailboxEnums.AttachmentType.File,
content: decryptedImageFile,
contentId: imageContentId,
isInline: true,
name: imageFileName
}
];
event.completed(
{
allowEvent: true,
emailBody: decryptedBody,
attachments: decryptedAttachments,
contextData: { messageType: "ReplyFromDecryptedMessage" }
}
);
}
属性
| coercion |
指定消息正文的格式。 消息正文的格式可以设置为 |
| content | 指定消息正文中显示的内容。 |
属性详细信息
coercionType
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定消息正文的格式。 消息正文的格式可以设置为 Office.CoercionType.Html 或 Office.CoercionType.Text。
coercionType: Office.CoercionType;
属性值
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
content
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定消息正文中显示的内容。
content: string;
属性值
string
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取