How to use the @microsoft/sp-page-context.SPPermission.addListItems function in @microsoft/sp-page-context

To help you get started, we’ve selected a few @microsoft/sp-page-context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-fx-extensions / samples / js-command-clone / src / extensions / spfxClone / SpfxCloneCommandSet.ts View on Github external
public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
    //Get a reference to our command
    const command: Command | undefined = this.tryGetCommand("spfxClone");

    if (command) {
      let allowed = true;

      //If Lists is specified, the command should only show up for named lists
      if(typeof this.properties.Lists !== "undefined" && this.properties.Lists.length > 0) {
        let lists = this.properties.Lists.split(',');
        allowed = lists.indexOf(this.context.pageContext.list.title) > -1;
      }
      //Only show the command if at least 1 row is selected and the user has permission to add list items
      command.visible = event.selectedRows.length >= 1 && this.context.pageContext.list.permissions.hasPermission(SPPermission.addListItems) && allowed;
    }
  }

@microsoft/sp-page-context

Page context services for the SharePoint Framework

https://aka.ms/spfx/license
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis

Similar packages