Skip to content

Instantly share code, notes, and snippets.

@estruyf
Created July 2, 2017 12:50
Show Gist options
  • Save estruyf/99b177cbdfd53237beb37649719dca78 to your computer and use it in GitHub Desktop.
Save estruyf/99b177cbdfd53237beb37649719dca78 to your computer and use it in GitHub Desktop.
SharePoint Framework ListView Command Set Extension - get selected items
@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
switch (event.commandId) {
case 'COMMAND_1':
// Check if the user selected some items
if (event.selectedRows.length > 0) {
// Check the selected rows
event.selectedRows.forEach((row: RowAccessor, index: number) => {
alert(`Field ID: ${row.getValueByName('ID')} - Field title: ${row.getValueByName('Title')}`);
});
}
break;
default:
throw new Error('Unknown command');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment