在Outlook加载项中,如何检查我们处于撰写模式还是阅读模式? [英] In an Outlook addin, how to check whether we are in compose mode or read mode?
问题描述
我正在创建一个Outlook加载项,并在React应用程序中使用OfficeJS API.在这里,我想为组合模式加载一组特定的功能,为读取模式加载另一组功能.所以我的问题是,如何查看我目前处于哪种模式?
I'm creating an outlook add-in and use the OfficeJS API in React app. In there I want to load a specific set of features for the compose mode and another set of features for the read mode. So my question is, how to see in which mode I'm currently on?
推荐答案
在manifest.xml
文件中,您应使用不同的ExtensionPoint
进行撰写和阅读,如下所示...
In the manifest.xml
file you should have different ExtensionPoint
for compose and read view as follow ...
<ExtensionPoint xsi:type="MessageReadCommandSurface">
</ExtensionPoint>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
</ExtensionPoint>
每个部分都必须具有ExecuteFunction
或ShowTaskpane
类型的Action
标记.如果您使用的是ExecuteFunction
类型,则只需为读取和编写表面指定不同的函数名称,如下所示...
Each of this sections have to have Action
tag with ExecuteFunction
or ShowTaskpane
type. If you have ExecuteFunction
type you just specify different function names for read and compose surface as follow ...
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<Action xsi:type="ExecuteFunction">
<FunctionName>FunctionSpecificToReadView</FunctionName>
</Action>
</ExtensionPoint>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<Action xsi:type="ExecuteFunction">
<FunctionName>FunctionSpecificToComposeView</FunctionName>
</Action>
</ExtensionPoint>
如果您使用的是ShowTaskpane
类型,则将使用不同的文件名将其加载到框架中,或者如果您使用如下所示的相同文件,则将添加一些参数...
If you have ShowTaskpane
type you would use different file names to load inside the frame or add some parameter if you use the same file as follow ...
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="readTaskPaneUrl" />
</Action>
</ExtensionPoint>
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="composeTaskPaneUrl" />
</Action>
</ExtensionPoint>
...
<Resources>
<bt:Urls>
<bt:Url id="readTaskPaneUrl" DefaultValue="https://localhost:44300/read.html"/>
<bt:Url id="composeTaskPaneUrl" DefaultValue="https://localhost:44300/compose.html"/>
</bt:Urls>
</Resources>
在每个HTML页面中,您都知道您的加载项被调用的表面.
Inside each HTML page you know what surface your add-in has been invoked.
这篇关于在Outlook加载项中,如何检查我们处于撰写模式还是阅读模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!