0

I am very new to SPFX and would like to know if you can help me. I have added a new option to the context menu; please see the photo below.

What I need is for when the users click on either of the new menus, it takes them to, for instance, https://google.com or another path.

Can you please let me know where in the code I can achieve this.

enter image description here

1 Answer 1

0

You have to write your business logic in onExecute method.

For example:

@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
  switch (event.itemId) {
    case 'COMMAND_1':
      window.open('https://google.com','_blank');
      break;
    case 'COMMAND_2':
      window.open('https://google.com','_blank');
      break;
    default:
      throw new Error('Unknown command');
  }
}

Documentation: Build your first ListView Command Set extension

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.