Office.EventType enum
指定引发的事件的类型。 由 type 对象的属性返回 *EventArgs 。
Project 加载项支持 Office.EventType.ResourceSelectionChanged、 和Office.EventType.ViewSelectionChangedOffice.EventType.TaskSelectionChanged事件类型。
只有 Outlook 的任务窗格加载项支持邮箱 API 集事件类型。
注解
使用方
- Office.AppointmentCompose: addHandlerAsync, removeHandlerAsync
- Office.AppointmentRead: addHandlerAsync, removeHandlerAsync
- Office.Binding: addHandlerAsync, removeHandlerAsync
- Office.BindingDataChangedEventArgs: type
- Office.BindingSelectionChangedEventArgs: type
- Office.CustomXmlPart: addHandlerAsync, removeHandlerAsync
- Office.Dialog: addEventHandler
- Office.DialogParentMessageReceivedEventArgs: type
- Office.Document: addHandlerAsync, removeHandlerAsync
- Office.DocumentSelectionChangedEventArgs: type
- Office.Mailbox: addHandlerAsync, removeHandlerAsync
- Office.MessageCompose: addHandlerAsync, removeHandlerAsync
- Office.MessageRead: addHandlerAsync, removeHandlerAsync
- Office.Settings: addHandlerAsync, removeHandlerAsync
- Office.SettingsChangedEventArgs: type
- Office.UI: addHandlerAsync
示例
// This sample shows how to register an event handler in Outlook.
Office.onReady(() => {
// Registers an event handler to identify when messages are selected.
Office.context.mailbox.addHandlerAsync(Office.EventType.SelectedItemsChanged, getMessageProperties, (asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
return;
}
console.log("Event handler added for the SelectedItemsChanged event.");
});
});
function getMessageProperties() {
// Retrieves the selected messages' properties and logs them to the console.
Office.context.mailbox.getSelectedItemsAsync((asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
return;
}
asyncResult.value.forEach((message) => {
console.log(`Item ID: ${message.itemId}`);
console.log(`Subject: ${message.subject}`);
console.log(`Item type: ${message.itemType}`);
console.log(`Item mode: ${message.itemMode}`);
});
});
}
字段
| ActiveViewChanged | 在 PowerPoint 中引发了一个 |
| AppointmentTimeChanged | 当 Outlook 中所选约会或系列的任何日期或时间更改时发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| AttachmentsChanged | 在向项目添加附件或从项目中删除附件时发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| BindingDataChanged | 在 Excel 或 Word 中更改绑定中的数据时发生。 要为 |
| BindingSelectionChanged | 在 Excel 或 Word 的绑定中更改所选内容时发生。 要为 |
| DialogEventReceived | 关闭对话框或对话框导航失败时发生。 有关如何在加载项中实现对话框的指南,请参阅在 Office 加载项中使用 Office 对话框 API。 |
| DialogMessageReceived | 当对话框使用 有关如何在加载项中实现对话框的指南,请参阅在 Office 加载项中使用 Office 对话框 API。 |
| DialogParentMessageReceived | 当主机页面使用 有关如何在加载项中实现对话框的指南,请参阅在 Office 加载项中使用 Office 对话框 API。 |
| DocumentSelectionChanged | 在 Excel 或 Word 中进行文档级别选择时发生。 |
| DragAndDropEvent | 在 Outlook 网页版和 Windows 上的新 Outlook 中,当 Outlook 客户端窗口中的邮件或文件附件被拖放到加载项的任务窗格中时发生。 要为
重要提示:Windows (经典) 和 Mac 上的 Outlook 不支持该 |
| EnhancedLocationsChanged | 在 Outlook 中更改约会位置时发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| InfobarClicked | 在 Outlook 中对具有定义 自定义操作的通知邮件选择操作时发生。 目前, 关闭 是触发此事件的唯一受支持操作。 要为 重要说明:
|
| InitializationContextChanged | 当从 可操作邮件、 InsightMessage 通知、 智能警报 对话框或 集成垃圾邮件报告 对话框打开加载项的任务窗格时,在 Outlook 中发生。 如果加载项任务窗格已在 Outlook 中打开,则此事件可阻止加载项重新启动。
重要提示:该 要为 |
| ItemChanged | 在固定任务窗格时选择了其他 Outlook 项进行查看时发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| NodeDeleted | 删除节点时 |
| NodeInserted | 在插入节点时 |
| NodeReplaced | 替换节点时 |
| OfficeThemeChanged | 在 Outlook 中更改 OfficeTheme 时发生。 要为 重要说明:
|
| RecipientsChanged | 当 Outlook 中所选项目或约会位置的收件人列表发生更改时。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| RecurrenceChanged | 当 Outlook 中所选系列的重复模式在 Outlook 中发生更改时发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| ResourceSelectionChanged | 在 Project 中进行资源选择时发生。 |
| SelectedItemsChanged | 选中或取消选择一封或多封邮件时在 Outlook 中出现。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| SensitivityLabelChanged | 当邮件或约会的敏感度标签更改时在 Outlook 中发生。 重要提示:此事件只能在任务窗格中处理。 函数命令无法为此事件注册处理程序。 要为 |
| SettingsChanged |
|
| SpamReporting | 报告未经请求的邮件时在 Outlook 中发生。 事件处理程序接收类型为 Office.SpamReportingEventArgs 的参数。 |
| TaskSelectionChanged | 在 Project 中执行任务选择时发生。 |
| ViewSelectionChanged | 在 Project 中选择视图时出现。 |