Office.DroppedItemDetails interface

アドインの作業ウィンドウにドラッグ アンド ドロップされているメッセージまたは添付ファイルの内容と詳細を提供します。

注釈

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

ドラッグ アンド ドロップ機能の詳細と、この機能をさまざまな Outlook クライアントに実装する方法の詳細については、「Outlook アドインの作業ウィンドウにメッセージと添付ファイルをドラッグ アンド ドロップする」を参照してください

使用元

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/80-events/drag-drop-item.yaml

function dragAndDropEventHandler(event) {
    Office.context.mailbox.addHandlerAsync(Office.EventType.DragAndDropEvent, (event) => {
    console.log(`Event type: ${event.type}`);

    const eventData = event.dragAndDropEventData;
    console.log(`x-coordinate: ${eventData.pageX}, y-coordinate: ${eventData.pageY}`);
    console.log(`x-coordinate relative to task pane: ${eventData.taskPaneX}, y-coordinate relative to task pane: ${eventData.taskPaneY}`);

    if (eventData.type == "drop") {
      console.log("Items dropped into task pane.");
      const files = eventData.dataTransfer.files;
      files.forEach((file) => {
        const content = file.fileContent;
        const name = file.name;
        const fileType = file.type;
        console.log(`File name: ${name}`);
        console.log(`File type: ${fileType}`);
        console.log(`Contents: ${content.text().then((text) => { console.log(text); })}`);
      });
    }
  });
}

プロパティ

fileContent

ドラッグ アンド ドロップされているファイルの内容を取得します。

name

ドラッグ アンド ドロップされているファイルの名前を取得します。

type

ドラッグ アンド ドロップされるファイルの種類を取得します。

プロパティの詳細

fileContent

ドラッグ アンド ドロップされているファイルの内容を取得します。

fileContent: Blob;

プロパティ値

Blob

注釈

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

Blob からデータを取得する方法のガイダンスについては、「ファイル API ドキュメント」を参照してください。

name

ドラッグ アンド ドロップされているファイルの名前を取得します。

name: string;

プロパティ値

string

注釈

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

type

ドラッグ アンド ドロップされるファイルの種類を取得します。

type: string;

プロパティ値

string

注釈

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

重要: メッセージがアドインの作業ウィンドウにドラッグされると、.emlファイルとしてドロップされます。