sharepoint online – SPFX – React – list / listItem/ page is undefined in this.context.pageContext

I am creating SPFX web part with React.

In which I am trying to get the current page ID on which webpart is added. I was trying to check if I can get it directly from the page context.

I am getting page context using this.context.pageContext but I noticed some of the properties are undefined.

like this.context.pageContext.list, this.context.pageContext.listItem, these are undefined.

Could any one please tell me the reason behind this. OR please guide me on how to get the ID of the page on which web part is added.

Thanks a lot.

sharepoint online – What’s the pros/cons of updating vs not updating version number on SPFx webparts or customizations?

In SPFx development, what is the benefits or disadvantages of updating or not updating the version number when updating in the app catalogue?

The best practice appears to be to update it to something higher, but it just seems it complicates the update process, because now you have to touch each site and manually update each customization per site. If you don’t, sure the app still gets the latest static resource update automatically, but it doesn’t fully upgrade the app in terms of some of its config settings.

Does anyone know?


sharepoint online – How does updating SPFx webparts/extensions work between tenant wide/non-tenant wide deployment models?

I am trying to understand the difference between deploying spfx customizations between tenant wide and non tenant wide (and differences when updating/not updating the version number). Per my current knowledge, I understand this so far

Tenant Wide:

Once you overwrite the solution, it updates everywhere automatically. This is true when keeping the version number the same.

If version number is increased, what happens here?

Non Tenant Wide:

If you overwrite the solution, it updates everywhere. This is true when keeping the version number the same. However for some webparts like listview command sets, it requires the app to be deleted from each site and its recycle bin, and needs an increase version number when adding to app catalogue.

If version number is increased, then apps will get a message on each site saying there is an update, and requires a manual update to fully update. While this is not done, only the static resources portion of the app will get the update automatically. Any manifest config-like changes won’t take effect until it is manually updated.

Can anyone confirm if these details are correct, or if there is anything more to be added?


SPFX Custom Property Pane not saving data

Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

sharepoint online – How to set up SPFx customizations on a shared tenant?

… for updating apps, I need to remove apps and re-add them back
again, per site which is really painful.

I don’t think, this is the case. Every time you add a new app package version to the global App catalog, all sites will get the latest updates automatically.

I will assume you are talking about the App customizer customizations. Headers, footers, custom actions, styles, etc.

Option #1: Deploy App globally

  • Create tenant-wide SPFx solution
  • In your SPFx code, in JavaScript/TypeScript, check the current site’s naming convention or site’s property bag value or something else that can tell you to which organization the site belongs.
  • If condition is not met, do nothing.

Option #2: Require App installation per site

  • Require app installation for every site
  • As part of the site provisioning process, make sure that the app your custom app is installed

For both options #1 and #2, you don’t need to worry about upgrading every single app instance every time you upload a new version to the App catalog. This should be handled automatically. JavaScript bundle is stored in a single place anyway, inside the App Catalog site.

sharepoint online – How to detect what the site template is in SPFx?

In SPFx modern sites, how can I detect what site template it is? In a shared tenant environment, I want to be able to be able to deploy them tenant wide, but disable them on certain sites (that are used by other organization). I was thinking of detecting them based on what site template is used. Anyone know?


sharepoint online – copying files from library to another library using SPFx

Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

sharepoint online – How to update SPFx extension instances tenant wide automatically?

In SPFx, I deployed a listviewcommandset extension to add a context menu option to list items. After adding to app catalogue, I had to manually add the app to the site. And then to update it, I had to delete the app from the site and recycle bin, increase the version number, re deploy the app to the catalogue and then add the app to the site again. Is there a way I can simplify the process and have it so that once I deploy, all sites just get the update automatically?

sharepoint online – How to set ContextMenu option in ListViewCommand Set in SPFx

In spfx listview command set, I want to add a new context menu option to list items. I have this


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
        ClientSideComponentProperties="{&quot;sampleTextOne&quot;:&quot;One item is selected in the list.&quot;, &quot;sampleTextTwo&quot;:&quot;This command is always visible.&quot;}">

and clientsideinstance.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
        Properties="{&quot;sampleTextOne&quot;:&quot;One item is selected in the list.&quot;, &quot;sampleTextTwo&quot;:&quot;This command is always visible.&quot;}"
        ComponentId="e15a3da8-5684-44f5-abc8-e9c72f5bb926" />

but when I test on gulp serve, it only appears in the top command bar, not on the list item. Anyone know what’s wrong?

sharepoint online – Show or hide SPFx extension based on user permissions

I like to show or hide extension as per user permission in SPFx ,suppose if user present in SP-group extension is visible or hide it

  public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
    var Libraryurl = this.context.pageContext.list.title; 
    const compareTwoCommand: Command = this.tryGetCommand('COMMAND_2');
    if (compareTwoCommand) {
      // This command should be hidden unless exactly one row is selected.
      const listname:string =this.context.pageContext.list.title
      const Librarylistname:string ="Documents"
      compareTwoCommand.visible =(event.selectedRows.length > 0 && Libraryurl == "Documents" )