Office.MessageDecryptEventCompletedOptions interface
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定 加密加载项 在处理 完 OnMessageRead 事件后的行为。
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 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" }
}
);
}
属性
| allow |
使用 completed 方法 指示事件处理程序完成时,此值指示事件是应继续运行还是 |
| attachments | 使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 |
| context |
使用 completed 方法发出事件处理程序完成信号并将其属性 |
| email |
使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 |
属性详细信息
allowEvent
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法 指示事件处理程序完成时,此值指示事件是应继续运行还是 OnMessageRead 应取消。 如果 属性 allowEvent 设置为 true,则显示消息的解密内容。
allowEvent: boolean;
属性值
boolean
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
attachments
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 allowEventtrue时,此属性将设置消息的解密附件。
attachments?: DecryptedMessageAttachment[];
属性值
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
contextData
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法发出事件处理程序完成信号并将其属性true设置为 allowEvent 时,此属性将指定传递给外接程序以进行处理的任何 JSON 数据。
contextData?: any;
属性值
any
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
重要说明:
若要检索 属性的值
contextData,必须调用Office.context.mailbox.item.getInitializationContextAsync。 如果使用 创建 JSON 字符串JSON.stringify()并将其分配给contextData属性,则必须在检索该字符串后使用JSON.parse()分析该字符串。可以使用
contextData属性来存储自定义 Internet 标头,以在答复和转发方案中解密消息。
emailBody
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法 发出事件处理程序完成信号并将其属性设置为 allowEventtrue时,此属性设置消息正文的解密内容。
emailBody?: DecryptedMessageBody;
属性值
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
重要说明:如果未 emailBody 指定 属性,则返回空正文。