Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Office.DroppedItems interface
- Package:
- outlook
Provides the messages or file attachments being dragged and dropped into an add-in's task pane.
Remarks
To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see Drag and drop messages and attachments into the task pane of an Outlook add-in.
Used by
Examples
// 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); })}`);
});
}
});
}
Properties
| files | Gets an array of the messages or file attachments being dragged and dropped into an add-in's task pane. |
Property Details
files
Gets an array of the messages or file attachments being dragged and dropped into an add-in's task pane.
files: DroppedItemDetails[]
Property Value
Remarks
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
Was this page helpful?
