0

There is an extension (custom ribbon) button on top of the list, that is connected to third-party apps, updating the list where you run it.

It's needed to restrict the extension to be used only in the list that is required to use it. I couldn't find it in the configurations while creating the list. Should it be a template?

The main question would be - how to restrict other lists have the button on top of them?

3
  • Is this extension developed by you or is 3rd party solution? If you have the extension code, you might be able to control it from code. Aug 2, 2022 at 7:46
  • I developed it using Microsoft's documentation of creating a custom extension with React. Aug 2, 2022 at 7:47
  • Check my answer given below & let me know if it helps. Aug 2, 2022 at 7:52

1 Answer 1

4

You can get the list name in code using this.context.pageContext.list.title and compare it with your list title as given below:

public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {  
    var Libraryurl = this.context.pageContext.list.title;  
     
    const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');  
    if (compareOneCommand) {  
      // This command should be hidden unless exactly one row is selected.  
      compareOneCommand.visible = (event.selectedRows.length === 1 && Libraryurl == "BotFiles" );  
    }  
}  

Source: SPFX Extension Apply List View Command Set to Specific List or Library

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.