Officejs:Outlook 操作可以触发任务窗格吗

问题描述 投票:0回答:1

我有两个问题。

  1. action有点击事件吗?我有一个简单的操作,如下所示: 如果用户单击该操作,我想运行一些打字稿代码,这可能吗?这些操作是否有事件处理程序?

  2. 从那个点击我可以打开作为我的插件一部分的任务窗格吗?我试过使用

    Office.addin.showAsTaskpane()
    但我没有运气触发任务窗格。我一直在 github 上关注这个问题,但即便如此,除了单击用于切换任务窗格的功能区按钮之外,我还没有成功地以任何其他方式打开我的任务窗格。

Github 问题

我尝试将

Office.addin.ShowAsTaskpane()
移动到我的
commands.ts
的几个区域。我已经在
onRready()
以及我的
event.complete()
之前和之后尝试过我的
commands.ts
的完整代码如下:

Office.onReady(() => {
  Office.addin.showAsTaskpane().then();
});

/**
 * Shows a notification when the add-in command is executed.
 * @param event
 */
function action(event: Office.AddinCommands.Event) {
  const message: Office.NotificationMessageDetails = {
    type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
    message: "Performed action. - Click",
    icon: "Icon.80x80",
    persistent: true,
  };
  // Show a notification message
  Office.context.mailbox.item.notificationMessages.replaceAsync("action", message);

  // Be sure to indicate when the add-in command function is complete
  event.completed();
  Office.addin.showAsTaskpane().then();
}

function getGlobal() {
  return typeof self !== "undefined"
    ? self
    : typeof window !== "undefined"
    ? window
    : typeof global !== "undefined"
    ? global
    : undefined;
}

const g = getGlobal() as any;

// The add-in command functions need to be available in global scope
g.action = action;
typescript office-js outlook-addin
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.