SharePoint extension command set

会有一股神秘感。 提交于 2020-01-25 08:57:05

问题


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).


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/53943139/sharepoint-extension-command-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!