Skip to content

Commit 1cedcfa

Browse files
[office-js][office-js-preview] (Outlook) Document drag-and-drop APIs (DefinitelyTyped#73278)
1 parent 04ddbd1 commit 1cedcfa

File tree

2 files changed

+369
-0
lines changed

2 files changed

+369
-0
lines changed

types/office-js-preview/index.d.ts

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,20 @@ declare namespace Office {
684684
* [Api set: Mailbox 1.5]
685685
*/
686686
ItemChanged,
687+
/**
688+
* Occurs in Outlook on the web and the new Outlook on Windows when messages or file attachments in the Outlook client window are
689+
* dragged then dropped into the task pane of an add-in.
690+
*
691+
* To add an event handler for the `ItemDraggedAndDropped` event, use the `addHandlerAsync` method of the `Mailbox` object.
692+
* The event handler receives an argument of type
693+
* {@link https://learn.microsoft.com/javascript/api/outlook/office.draganddropeventargs | Office.DragAndDropEventArgs}.
694+
*
695+
* **Important**: The `ItemDraggedAndDropped` event isn't supported in Outlook on Windows (classic) and on Mac. If the `ItemDraggedAndDropped` handler
696+
* runs on these clients, an error occurs ("This event isn't supported on this platform.").
697+
*
698+
* [Api set: Mailbox 1.5]
699+
*/
700+
ItemDraggedAndDropped,
687701
/**
688702
* Triggers when a `customXmlPart` node is deleted.
689703
*/
@@ -14561,6 +14575,177 @@ declare namespace Office {
1456114575
*/
1456214576
setAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
1456314577
}
14578+
/**
14579+
* Provides details about the mouse pointer position and the messages or file attachments being dragged and dropped into an add-in's task pane when the
14580+
* `Office.EventType.ItemDraggedAndDropped` event is raised.
14581+
*
14582+
* @remarks
14583+
*
14584+
* [Api set: Mailbox 1.5]
14585+
*
14586+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14587+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14588+
*/
14589+
export interface DragAndDropEventArgs {
14590+
/**
14591+
* Gets the details about the mouse pointer position within an add-in's task pane and the messages or file attachments being dragged and dropped into the task pane.
14592+
*
14593+
* @remarks
14594+
*
14595+
* [Api set: Mailbox 1.5]
14596+
*/
14597+
dragAndDropEventData: DragoverEventData | DropEventData;
14598+
/**
14599+
* Gets the type of the event. For details, see {@link https://learn.microsoft.com/javascript/api/office/office.eventtype | Office.EventType}.
14600+
*
14601+
* [Api set: Mailbox 1.5]
14602+
*/
14603+
type: "olkDragAndDropEvent";
14604+
}
14605+
/**
14606+
* Represents the `DragAndDropEventArgs.dragAndDropEventData` object when messages or file attachments are dragged over an add-in's task pane.
14607+
*
14608+
* @remarks
14609+
*
14610+
* [Api set: Mailbox 1.5]
14611+
*
14612+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14613+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14614+
*/
14615+
interface DragoverEventData {
14616+
/**
14617+
* Gets the x-coordinate of the mouse pointer that represents the horizontal position in pixels.
14618+
* The position is relative to the left edge of the Outlook on the web or the new Outlook on Windows client window.
14619+
*
14620+
* @remarks
14621+
*
14622+
* [Api set: Mailbox 1.5]
14623+
*/
14624+
pageX: number;
14625+
/**
14626+
* Gets the y-coordinate of the mouse pointer that represents the vertical position in pixels.
14627+
* The position is relative to the top edge of the Outlook on the web or the new Outlook on Windows client window.
14628+
*
14629+
* @remarks
14630+
*
14631+
* [Api set: Mailbox 1.5]
14632+
*/
14633+
pageY: number;
14634+
/**
14635+
* Gets the type of drag-and-drop event. The `dragover` event occurs when messages or file attachments are dragged over an add-in's task pane.
14636+
*
14637+
* @remarks
14638+
*
14639+
* [Api set: Mailbox 1.5]
14640+
*/
14641+
type: "dragover";
14642+
}
14643+
/**
14644+
* Represents the `DragAndDropEventArgs.dragAndDropEventData` object when messages or file attachments are dropped into an add-in's task pane.
14645+
*
14646+
* @remarks
14647+
*
14648+
* [Api set: Mailbox 1.5]
14649+
*
14650+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14651+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14652+
*/
14653+
interface DropEventData {
14654+
/**
14655+
* Gets the messages or file attachments being dragged and dropped into an add-in's task pane.
14656+
*
14657+
* @remarks
14658+
*
14659+
* [Api set: Mailbox 1.5]
14660+
*/
14661+
dataTransfer: DroppedItems;
14662+
/**
14663+
* Gets the x-coordinate of the mouse pointer that represents the horizontal position in pixels.
14664+
* The position is relative to the left edge of the Outlook on the web or the new Outlook on Windows client window.
14665+
*
14666+
* @remarks
14667+
*
14668+
* [Api set: Mailbox 1.5]
14669+
*/
14670+
pageX: number;
14671+
/**
14672+
* Gets the y-coordinate of the mouse pointer that represents the vertical position in pixels.
14673+
* The position is relative to the top edge of the Outlook on the web or the new Outlook on Windows client window.
14674+
*
14675+
* @remarks
14676+
*
14677+
* [Api set: Mailbox 1.5]
14678+
*/
14679+
pageY: number;
14680+
/**
14681+
* Gets the type of drag-and-drop event. The `drop` event occurs when messages or file attachments are dropped into an add-in's task pane.
14682+
*
14683+
* @remarks
14684+
*
14685+
* [Api set: Mailbox 1.5]
14686+
*/
14687+
type: "drop";
14688+
}
14689+
/**
14690+
* Provides the messages or file attachments being dragged and dropped into an add-in's task pane.
14691+
*
14692+
* @remarks
14693+
*
14694+
* [Api set: Mailbox 1.5]
14695+
*
14696+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14697+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14698+
*/
14699+
interface DroppedItems {
14700+
/**
14701+
* Gets an array of the messages or file attachments being dragged and dropped into an add-in's task pane.
14702+
*
14703+
* @remarks
14704+
*
14705+
* [Api set: Mailbox 1.5]
14706+
*/
14707+
files: DroppedItemDetails[]
14708+
}
14709+
/**
14710+
* Provides the contents and details of the message or file attachment being dragged and dropped into an add-in's task pane.
14711+
*
14712+
* @remarks
14713+
*
14714+
* [Api set: Mailbox 1.5]
14715+
*
14716+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14717+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14718+
*/
14719+
interface DroppedItemDetails {
14720+
/**
14721+
* Gets the contents of the file being dragged and dropped.
14722+
*
14723+
* @remarks
14724+
*
14725+
* [Api set: Mailbox 1.5]
14726+
*
14727+
* For guidance on how to retrieve data from a `Blob`, see the {@link https://developer.mozilla.org/docs/Web/API/Blob | File API documentation}.
14728+
*/
14729+
fileContent: Blob;
14730+
/**
14731+
* Gets the name of the file being dragged and dropped.
14732+
*
14733+
* @remarks
14734+
*
14735+
* [Api set: Mailbox 1.5]
14736+
*/
14737+
name: string;
14738+
/**
14739+
* Gets the type of the file being dragged and dropped.
14740+
*
14741+
* @remarks
14742+
*
14743+
* [Api set: Mailbox 1.5]
14744+
*
14745+
* **Important**: When a message is dragged into an add-in's task pane, it's dropped as a .eml file.
14746+
*/
14747+
type: string;
14748+
}
1456414749
/**
1456514750
* Provides the email properties of the sender or specified recipients of an email message or appointment.
1456614751
*

types/office-js/index.d.ts

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,20 @@ declare namespace Office {
684684
* [Api set: Mailbox 1.5]
685685
*/
686686
ItemChanged,
687+
/**
688+
* Occurs in Outlook on the web and the new Outlook on Windows when messages or file attachments in the Outlook client window are
689+
* dragged then dropped into the task pane of an add-in.
690+
*
691+
* To add an event handler for the `ItemDraggedAndDropped` event, use the `addHandlerAsync` method of the `Mailbox` object.
692+
* The event handler receives an argument of type
693+
* {@link https://learn.microsoft.com/javascript/api/outlook/office.draganddropeventargs | Office.DragAndDropEventArgs}.
694+
*
695+
* **Important**: The `ItemDraggedAndDropped` event isn't supported in Outlook on Windows (classic) and on Mac. If the `ItemDraggedAndDropped` handler
696+
* runs on these clients, an error occurs ("This event isn't supported on this platform.").
697+
*
698+
* [Api set: Mailbox 1.5]
699+
*/
700+
ItemDraggedAndDropped,
687701
/**
688702
* Triggers when a `customXmlPart` node is deleted.
689703
*/
@@ -14342,6 +14356,176 @@ declare namespace Office {
1434214356
*/
1434314357
OWAView: MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns";
1434414358
}
14359+
/**
14360+
* Provides details about the mouse pointer position and the messages or file attachments being dragged and dropped into an add-in's task pane when the
14361+
* `Office.EventType.ItemDraggedAndDropped` event is raised.
14362+
*
14363+
* @remarks
14364+
*
14365+
* [Api set: Mailbox 1.5]
14366+
*
14367+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14368+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14369+
*/
14370+
export interface DragAndDropEventArgs {
14371+
/**
14372+
* Gets the details about the mouse pointer position within an add-in's task pane and the messages or file attachments being dragged and dropped into the task pane.
14373+
*
14374+
* @remarks
14375+
*
14376+
* [Api set: Mailbox 1.5]
14377+
*/
14378+
dragAndDropEventData: DragoverEventData | DropEventData;
14379+
/**
14380+
* Gets the type of the event. For details, see {@link https://learn.microsoft.com/javascript/api/office/office.eventtype | Office.EventType}.
14381+
*
14382+
* [Api set: Mailbox 1.5]
14383+
*/
14384+
type: "olkDragAndDropEvent";
14385+
}
14386+
/**
14387+
* Represents the `DragAndDropEventArgs.dragAndDropEventData` object when messages or file attachments are dragged over an add-in's task pane.
14388+
*
14389+
* @remarks
14390+
*
14391+
* [Api set: Mailbox 1.5]
14392+
*
14393+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14394+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14395+
*/
14396+
interface DragoverEventData {
14397+
/**
14398+
* Gets the x-coordinate of the mouse pointer that represents the horizontal position in pixels.
14399+
* The position is relative to the left edge of the Outlook on the web or the new Outlook on Windows client window.
14400+
*
14401+
* @remarks
14402+
*
14403+
* [Api set: Mailbox 1.5]
14404+
*/
14405+
pageX: number;
14406+
/**
14407+
* Gets the y-coordinate of the mouse pointer that represents the vertical position in pixels.
14408+
* The position is relative to the top edge of the Outlook on the web or the new Outlook on Windows client window.
14409+
*
14410+
* @remarks
14411+
*
14412+
* [Api set: Mailbox 1.5]
14413+
*/
14414+
pageY: number;
14415+
/**
14416+
* Gets the type of drag-and-drop event. The `dragover` event occurs when messages or file attachments are dragged over an add-in's task pane.
14417+
*
14418+
* @remarks
14419+
*
14420+
* [Api set: Mailbox 1.5]
14421+
*/
14422+
type: "dragover";
14423+
}
14424+
/**
14425+
* Represents the `DragAndDropEventArgs.dragAndDropEventData` object when messages or file attachments are dropped into an add-in's task pane.
14426+
*
14427+
* @remarks
14428+
*
14429+
* [Api set: Mailbox 1.5]
14430+
*
14431+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14432+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14433+
*/
14434+
interface DropEventData {
14435+
/**
14436+
* Gets the messages or file attachments being dragged and dropped into an add-in's task pane.
14437+
*
14438+
* @remarks
14439+
*
14440+
* [Api set: Mailbox 1.5]
14441+
*/
14442+
dataTransfer: DroppedItems;
14443+
/**
14444+
* Gets the x-coordinate of the mouse pointer that represents the horizontal position in pixels.
14445+
* The position is relative to the left edge of the Outlook on the web or the new Outlook on Windows client window.
14446+
*
14447+
* @remarks
14448+
*
14449+
* [Api set: Mailbox 1.5]
14450+
*/
14451+
pageX: number;
14452+
/**
14453+
* Gets the y-coordinate of the mouse pointer that represents the vertical position in pixels.
14454+
* The position is relative to the top edge of the Outlook on the web or the new Outlook on Windows client window.
14455+
* @remarks
14456+
*
14457+
* [Api set: Mailbox 1.5]
14458+
*/
14459+
pageY: number;
14460+
/**
14461+
* Gets the type of drag-and-drop event. The `drop` event occurs when messages or file attachments are dropped into an add-in's task pane.
14462+
*
14463+
* @remarks
14464+
*
14465+
* [Api set: Mailbox 1.5]
14466+
*/
14467+
type: "drop";
14468+
}
14469+
/**
14470+
* Provides the messages or file attachments being dragged and dropped into an add-in's task pane.
14471+
*
14472+
* @remarks
14473+
*
14474+
* [Api set: Mailbox 1.5]
14475+
*
14476+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14477+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14478+
*/
14479+
interface DroppedItems {
14480+
/**
14481+
* Gets an array of the messages or file attachments being dragged and dropped into an add-in's task pane.
14482+
*
14483+
* @remarks
14484+
*
14485+
* [Api set: Mailbox 1.5]
14486+
*/
14487+
files: DroppedItemDetails[]
14488+
}
14489+
/**
14490+
* Provides the contents and details of the message or file attachment being dragged and dropped into an add-in's task pane.
14491+
*
14492+
* @remarks
14493+
*
14494+
* [Api set: Mailbox 1.5]
14495+
*
14496+
* To learn more about the drag-and-drop feature and how to implement it across various Outlook clients, see
14497+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/drag-drop-items | Drag and drop messages and attachments into the task pane of an Outlook add-in}.
14498+
*/
14499+
interface DroppedItemDetails {
14500+
/**
14501+
* Gets the contents of the file being dragged and dropped.
14502+
*
14503+
* @remarks
14504+
*
14505+
* [Api set: Mailbox 1.5]
14506+
*
14507+
* For guidance on how to retrieve data from a `Blob`, see the {@link https://developer.mozilla.org/docs/Web/API/Blob | File API documentation}.
14508+
*/
14509+
fileContent: Blob;
14510+
/**
14511+
* Gets the name of the file being dragged and dropped.
14512+
*
14513+
* @remarks
14514+
*
14515+
* [Api set: Mailbox 1.5]
14516+
*/
14517+
name: string;
14518+
/**
14519+
* Gets the type of the file being dragged and dropped.
14520+
*
14521+
* @remarks
14522+
*
14523+
* [Api set: Mailbox 1.5]
14524+
*
14525+
* **Important**: When a message is dragged into an add-in's task pane, it's dropped as a .eml file.
14526+
*/
14527+
type: string;
14528+
}
1434514529
/**
1434614530
* Provides the email properties of the sender or specified recipients of an email message or appointment.
1434714531
*

0 commit comments

Comments
 (0)