Office.DecryptedMessageAttachment 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" }
}
);
}
属性
| attachment |
指定附件的类型。 |
| content | 指定附件的 Base64 编码内容。 |
| content |
指定内联附件的内容标识符。
|
| is |
如果为 true,则指定解密附件在邮件正文而不是附件列表中显示为图像。 如果未指定属性 |
| name | 指定附件的名称。 |
| path | 如果附件的类型为 |
属性详细信息
attachmentType
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定附件的类型。
attachmentType: MailboxEnums.AttachmentType;
属性值
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
content
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定附件的 Base64 编码内容。
content: string;
属性值
string
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
重要说明:类型contentMailboxEnums.AttachmentType.Cloud为 的附件不支持 属性。
contentId
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定内联附件的内容标识符。
contentId如果 isInline 设置为 true,则必须指定 属性。
contentId?: string;
属性值
string
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
重要提示:当图像作为内联附件添加到邮件时,会自动为其分配内容 ID。 在邮件正文中,内联附件的内容 ID 在元素 (的 属性<img>中src指定, <img width=96 height=96 id="Picture_1" src="cid:image001.png@01DC1E6F.FC7C7410"> 例如,) 。 为了在解密期间轻松识别并提供这些内联附件,我们建议在加密期间将内联附件的内容 ID 保存到邮件头。 调用 Office.context.mailbox.item.getAttachmentsAsync 以获取内联附件的内容 ID。 然后,调用 Office.context.mailbox.item.internetHeaders.setAsync 以将 ID 保存到消息的标头。
isInline
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
如果为 true,则指定解密附件在邮件正文而不是附件列表中显示为图像。 如果未指定属性 isInline ,则其值设置为 false。
isInline?: boolean;
属性值
boolean
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
name
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
指定附件的名称。
name: string;
属性值
string
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取
path
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
如果附件的类型为 MailboxEnums.AttachmentType.Cloud,则指定附件的 URL 引用路径。
path必须为 类型的MailboxEnums.AttachmentType.Cloud附件指定 属性。
path?: string;
属性值
string
注解
[ API 集:邮箱预览 ]
最低权限级别: 读/写项
适用的 Outlook 模式:邮件读取