问题
Is it possible to add an Outlook Web Addin function to the context menu? As it was possible with the old VSTO Addins:
I only find some examples with tab ribbons, like:
<!--PrimaryCommandSurface==Main Office Ribbon-->
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<CustomTab id="Contoso.Tab1">
<Group id="Contoso.Tab1.Group1">
<Label resid="Contoso.Tab1.GroupLabel" />
<Icon>
<bt:Image size="16" resid="Contoso.TaskpaneButton.Icon" />
<bt:Image size="32" resid="Contoso.TaskpaneButton.Icon" />
<bt:Image size="80" resid="Contoso.TaskpaneButton.Icon" />
</Icon>
<!--Control. It can be of type "Button" or "Menu" -->
<Control xsi:type="Button" id="Contoso.FunctionButton">
<Label resid="Contoso.FunctionButton.Label" />
回答1:
Outlook Web Add-ins allow customizing the ribbon by adding commands only. Read more about that in the Add-in commands for Outlook article.
回答2:
From what I can tell this might be possible. You can find an example here for a different Office app, but I assume that it should hold true for Outlook as well. In Excel a context menu is added with adding the following code to the manifest. Please note that the code below does not include the references (resid's) to urls, long strings and short strings.
<!-- ContextMenu extends selected context menus (E.g. right click menu)-->
<ExtensionPoint xsi:type="ContextMenu">
<!--The id of the menu specifies the existing context menu being extended-->
<!--ContextMenuCell (Excel) and ContextMenuText (Word) are currently supported-->
<OfficeMenu id="ContextMenuCell">
<Control xsi:type="Menu" id="Contoso.TestMenu2">
<Label resid="residLabel3" />
<Supertip>
<Title resid="residLabel" />
<Description resid="residToolTip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon1_32x32" />
<bt:Image size="32" resid="icon1_32x32" />
<bt:Image size="80" resid="icon1_32x32" />
</Icon>
<Items>
<Item id="showGallery2">
<Label resid="residLabel3"/>
<Supertip>
<Title resid="residLabel" />
<Description resid="residToolTip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon1_32x32" />
<bt:Image size="32" resid="icon1_32x32" />
<bt:Image size="80" resid="icon1_32x32" />
</Icon>
<Action xsi:type="ShowTaskpane">
<!--TaskPaneId is required. It is currently not used by the framework but it will be in a future iteration -->
<TaskpaneId>MyTaskPaneID1</TaskpaneId>
<!--The URL to show inside the taskpane -->
<SourceLocation resid="residUnitConverterUrl" />
</Action>
</Item>
<Item id="showGallery3">
<Label resid="residLabel5"/>
<Supertip>
<Title resid="residLabel" />
<Description resid="residToolTip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon1_32x32" />
<bt:Image size="32" resid="icon1_32x32" />
<bt:Image size="80" resid="icon1_32x32" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>MyTaskPaneID2</TaskpaneId>
<SourceLocation resid="residUnitConverterUrl" />
</Action>
</Item>
</Items>
</Control>
</OfficeMenu>
</ExtensionPoint>
来源:https://stackoverflow.com/questions/48750675/add-outlook-web-addin-function-to-context-menu