Office.MessageDecryptEventCompletedOptions interface
指定 加密加载项 在处理完 OnMessageDecrypt 事件后的行为。
注解
最低权限级别: 读取/写入项目
适用的 Outlook 模式:消息阅读
使用方
示例
// This sample handles the OnMessageDecrypt event to decrypt the body and attachments of a message.
function onMessageDecryptHandler(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 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.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" }
}
);
}
属性
| access |
使用 completed 方法发出事件处理程序完成的信号并将其属性 |
| allow |
使用 completed 方法 发出事件处理程序完成的信号时,此值指示 |
| attachments | 使用 completed 方法发出事件处理程序完成的信号并将其属性 |
| context |
使用 completed 方法发出事件处理程序完成的信号并将其属性 |
| email |
使用 completed 方法发出事件处理程序完成的信号并将其属性 |
| error |
使用 completed 方法发出事件处理程序完成的信号并将其属性 |
属性详细信息
accessControls
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法发出事件处理程序完成的信号并将其属性true设置为 allowEvent 时,此属性指定是否可以复制和粘贴、打印或保存消息的已解密内容。
accessControls?: AccessControls;
属性值
注解
allowEvent
使用 completed 方法 发出事件处理程序完成的信号时,此值指示 OnMessageDecrypt 事件是应该继续运行还是取消。 如果该 allowEvent 属性设置为 true,将显示消息的解密内容。
allowEvent: boolean;
属性值
boolean
注解
最低权限级别: 读取/写入项目
适用的 Outlook 模式:消息阅读
attachments
使用 completed 方法发出事件处理程序完成的信号并将其属性true设置为 allowEvent 时,此属性将设置消息的解密附件。
attachments?: DecryptedMessageAttachment[];
属性值
注解
最低权限级别: 读取/写入项目
适用的 Outlook 模式:消息阅读
contextData
使用 completed 方法发出事件处理程序完成的信号并将其属性true设置为 allowEvent 时,此属性指定传递给加载项进行处理的任何 JSON 数据。
contextData?: any;
属性值
any
注解
最低权限级别: 读取/写入项目
适用的 Outlook 模式:消息阅读
重要说明:
要检索属性的
contextData值,必须调用Office.context.mailbox.item.getInitializationContextAsync。 如果使用JSON.stringify()JSON 字符串创建 JSON 字符串并将其分配给contextData属性,则必须在检索字符串后使用它来JSON.parse()解析字符串。可以使用该
contextData属性存储自定义 Internet 标头,以便在答复和转发方案中解密邮件。
emailBody
使用 completed 方法发出事件处理程序完成的信号并将其属性true设置为 allowEvent 时,此属性将设置消息正文的解密内容。
emailBody?: DecryptedMessageBody;
属性值
注解
最低权限级别: 读取/写入项目
适用的 Outlook 模式:消息阅读
重要提示: 如果未指定该 emailBody 属性,则返回空正文。
errorMessage
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
使用 completed 方法发出事件处理程序完成的信号并将其属性false设置为 allowEvent 时,此属性将设置显示给用户的错误消息。
errorMessage?: string;
属性值
string
注解
重要说明:
仅当属性设置为
false时才使用allowEvent该errorMessage属性。 如果将该allowEvent属性true设置为 ,则会忽略该errorMessage属性。如果未在属性中
errorMessage指定消息,则会改为显示以下默认消息:“加载项名称>错误<:无法解密邮件。”向用户显示时,自定义错误消息会自动在前面加上“加载项名称>错误<:”。