Office.ContextMenuControl interface

表示单个上下文菜单控件及其状态。

若要了解详细信息,请参阅 更改加载项命令的可用性。

注解

要求集ContextMenuAPI 1.1

示例

// Change the availability of custom buttons on the context menu.
await Office.contextMenu.requestUpdate({
    controls: [
        {
            id: Addin.CtxMenu.Button1,
            enabled: true
        },
        {
            id: Addin.CtxMenu.Button2,
            enabled: false
        },
    ]
});

属性

enabled

指示控件在上下文菜单上是否可用。

id

清单中指定的上下文菜单控件的标识符。

属性详细信息

enabled

指示控件在上下文菜单上是否可用。

enabled?: boolean;

属性值

boolean

id

清单中指定的上下文菜单控件的标识符。

id: string;

属性值

string