Appreciate the good work in helping the SPFx community.

We have an issue with a custom ListView command set extension.

We are trying to implement an Export to Excel action for selected list items in a list view. When the list items were selected, we get access to the event.selectedrows by default. But we don't actually know what list this is, or what are the columns in this view. I have searched everywhere but no help.

Any help would be greatly appreciated!

1 Answer 1


Your CommandSet inherits from BaseListViewCommandSet which contains a context of type ListViewCommandSetContext.

The ListViewCommandSetContext which contains listview which should give you information about the view, but doesn't seem for give any info.

The ListViewCommandSetContext inherits from BaseComponentContext (through ExtensionContext) which gives you pageContext of type PageContext which gives you your list as a SPList.

So you can access list information like this: this.context.pageContext.list.serverRelativeUrl

  • Thank you. But the this.pagecontext.listViews returns 0 columns. Nov 6, 2017 at 22:23

Your Answer

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

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