SharePoint扩展命令集

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

SharePoint Modern:是否可以使用特定列表的命令集添加自定义操作,或者如何激活特定列表的自定义操作?我正在尝试为特定列表开发自定义操作,但是当我在SharePoint租户中部署时,将为所有列表添加此自定义操作(相同类型的列表模板)。

sharepoint office365 sharepoint-online sharepointframework
2个回答
0
投票

这是我的测试解决方案,将命令集扩展限制为特定列表。

我们可以通过this.context.pageContext.list.title获得当前的列表标题。

@override
  public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {    
    const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
    if (compareOneCommand) {
      // This command should be hidden unless exactly one row is selected.
      compareOneCommand.visible = this.context.pageContext.list.title === 'MyList3';      
    }
  }

One similar thread


0
投票

是的..你可以用列表ID检查它,如果匹配make命令.visible == true

© www.soinside.com 2019 - 2024. All rights reserved.