SharePoint extension command set

2019-08-24 04:51发布

SharePoint Modern: Is it possible to add an custom action using command set for a particular list or how to activate a custom action for specific list? I am trying to develop a custom action for specific list but when I deployed in SharePoint tenant this custom action is added for all list(same type of list template).

2条回答
forever°为你锁心
2楼-- · 2019-08-24 05:38

Yes it is.. You can check it with the list id, and if matches make command.visible == true

查看更多
成全新的幸福
3楼-- · 2019-08-24 05:55

Here is my test solution to limit command set extension to specific list.

We could get current list title by 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

查看更多
登录 后发表回答