0

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 Answers2

0

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

Lee
  • 5,305
  • 1
  • 6
  • 12
0

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