【发布时间】:2020-08-01 05:25:09
【问题描述】:
我有一个带有 2 个选项的 Outlook 插件:1 个按钮用于“操作”+1 个按钮用于“任务窗格”。 我正在 Office 365 Web 中测试我的插件。
在 '任务窗格' 代码(与任务窗格关联的 .js 文件)中,我有以下代码:
Office.onReady(info => {
if (info.host === Office.HostType.Outlook) {
console.log("Hello from pane");
...
当我点击插件中的'action'时,也会调用这段代码(打印“Hello from pane”)
没事吧?如果是这样,我怎么知道按下的是“任务窗格”选项,而不是“操作”?
我的 XML 清单中的信息:
<!-- New Appointment -->
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
<OfficeTab id="TabDefault">
<!-- Up to 6 Groups added per Tab -->
<Group id="Group">
<Label resid="Group.Label" />
<!-- Launch the add-in : action button -->
<Control xsi:type="Button" id="ButtonAction">
<Label resid="Action.Label" />
<Supertip>
<Title resid="Action.Supertip.Title" />
<Description resid="Action.Supertip.Desc" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>myAction</FunctionName>
</Action>
</Control>
<!-- Launch the add-in : task pane button -->
<Control xsi:type="Button" id="ButtonOpenPane">
<Label resid="OpenPane.Label" />
<Supertip>
<Title resid="OpenPane.Supertip.Title" />
<Description resid="OpenPane.Supertip.Desc" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="OpenPane.Action.location" />
</Action>
</Control>
<!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
</Group>
</OfficeTab>
</ExtensionPoint>
...
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="...FunctionFile.html"/>
<bt:Url id="OpenPane.Action.location" DefaultValue="...taskpane.html"/>
</bt:Urls>
提前致谢, 迭戈
【问题讨论】:
-
这听起来不对。您是否可以从任务窗格按钮 HTML 和操作按钮 HTML 中引用此 .js 文件?你能分享你的清单吗?另外,您正在使用哪个 Outlook 客户端以及哪个版本?针对哪种帐户 - Microsoft 365 或本地 Exchange 服务器?
-
谢谢,我在帖子中添加了信息
-
谢谢!您是否有机会从 FunctionFile.html 和 taskpane.html 中引用 .js 文件?此问题是否也会在 Windows 或 Mac Outlook 上重现(如果您有任何这些客户端)还是仅在 Office 365 Web 中重现?
-
这就是问题所在,我从 FunctionFile.html 引用了 .js 文件...我应该检测到它。非常感谢