SharePoint Modern:是否可以使用特定列表的命令集添加自定义操作,或者如何激活特定列表的自定义操作?我正在尝试为特定列表开发自定义操作,但是当我在SharePoint租户中部署时,将为所有列表添加此自定义操作(相同类型的列表模板)。
这是我的测试解决方案,将命令集扩展限制为特定列表。
我们可以通过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';
}
}
是的..你可以用列表ID检查它,如果匹配make命令.visible == true