Office.DecryptedMessageAttachment interface

暗号化解除されたメッセージの添付ファイルを表します。

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り

Outlook で暗号化アドインを開発する方法については、「 暗号化 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" }
        }
    );
}

プロパティ

attachmentType

添付ファイルの種類を指定します。

content

添付ファイルの Base64 でエンコードされたコンテンツを指定します。

contentId

インライン 添付ファイルのコンテンツ識別子を指定します。

isInline が true に設定されている場合は、contentId プロパティを指定する必要があります。

isInline

true の場合、復号化された添付ファイルが添付ファイル リストではなく、メッセージ本文に画像として表示されるように指定します。 isInline プロパティが指定されていない場合、その値は false に設定されます。

name

添付ファイルの名前を指定します。

path

添付ファイルの種類が MailboxEnums.AttachmentType.Cloud の場合、添付ファイルの URL 参照パスを指定します。 path プロパティは、タイプ MailboxEnums.AttachmentType.Cloud の添付ファイルに対して指定する必要があります。

プロパティの詳細

attachmentType

添付ファイルの種類を指定します。

attachmentType: MailboxEnums.AttachmentType;

プロパティ値

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り

重要: タイプ MailboxEnums.AttachmentType.Item の添付ファイルは現在運用環境ではサポートされていません。 ただし、Outlook on the web および Windows (新規およびクラシック) で MailboxEnums.AttachmentType.Item タイプのサポートをプレビューできます。 従来の Outlook on Windows の場合は、バージョン 2606 (ビルド 20114.15110) 以降をインストールする必要があります。 次に、 Microsoft 365 Insider プログラム に参加し、 ベータ チャネル オプションを選択して Office ベータ ビルドにアクセスします。

content

添付ファイルの Base64 でエンコードされたコンテンツを指定します。

content: string;

プロパティ値

string

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り

重要: content プロパティは、タイプ MailboxEnums.AttachmentType.Cloud の添付ファイルではサポートされていません。

contentId

インライン 添付ファイルのコンテンツ識別子を指定します。

isInline が true に設定されている場合は、contentId プロパティを指定する必要があります。

contentId?: string;

プロパティ値

string

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な 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

true の場合、復号化された添付ファイルが添付ファイル リストではなく、メッセージ本文に画像として表示されるように指定します。 isInline プロパティが指定されていない場合、その値は false に設定されます。

isInline?: boolean;

プロパティ値

boolean

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り

name

添付ファイルの名前を指定します。

name: string;

プロパティ値

string

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り

path

添付ファイルの種類が MailboxEnums.AttachmentType.Cloud の場合、添付ファイルの URL 参照パスを指定します。 path プロパティは、タイプ MailboxEnums.AttachmentType.Cloud の添付ファイルに対して指定する必要があります。

path?: string;

プロパティ値

string

注釈

API セット: メールボックス 1.16

最小アクセス許可レベル: 項目の読み取り/書き込み

適用可能な Outlook モード: メッセージの読み取り