Mange SPFx extensions from macOS with Office 365 CLI

SPFx extensions are used to customize the modern SharePoint user experience, built using script frameworks they can be built using any operating system.

Currently there is no graphical interface to manage the extensions and all the operations need to be done from the command line using PowerShell.

Well it use to be like that but not anymore, with the Office 365 CLI you no longer need to use PowerShell and Windows to manage the extensions if you are a macOS or Linux user you can do it directly from your native operating system.

Note: In this article, I’ll use one of the Google Analytics extensions that I built in this article.

How to manage Office 365 from macOS

To manage Office 365 from macOS you first need to install the Office 365 CLI, to do it open the terminal and execute the command below.

npm i -g @pnp/office365-cli

Install SPFx extensions

  1. Open your App Catalog and upload the sppkg file, the Google Analytics file can be downloaded from here
  2. Check the box Make this solution available to all sites in the organization
    SPFx Extention Project

Activate SPFx extensions from macOS

  1. Open the terminal and type office365 to start the Office 365 CLI
  2. To connect to the SharePoint site collection where the extension will be activated type the command bellow
    spo connect https://contoso.sharepoint.com/
  3. Copy the code provided and open the link in the browser to do the authentication
    office 365 cli login
  4. To enable the Application Customizer extension type the command bellow
  5. spo customaction add -u https://contoso.sharepoint.com/ -t "Analytics" -n "Analytics" -l "ClientSideExtension.ApplicationCustomizer" -c 9811e000-540c-479c-8436-1cb4c4fd0484 -p '{"trackingID":"UA-92611503-1"}' -s site

    Options used in the command:

    -u, Url of the site or site collection to add the custom action

    -n, The name of the custom action

    -t, The title of the custom action

    -l, The actual location where this custom action need to be added like ” ClientSideExtension.ApplicationCustomizer”

    -c, The Client Side Component Id (GUID) of the custom action

    -s, Scope of the custom action. Allowed values Site|Web. Default Web

    -p, The Client Side Component Properties of the custom action. Specify values as a JSON string : “{Property1 : “Value1”, Property2: “Value2″}”

Deactivate SPFx extensions from macOS

  1. To get all the enabled extensions type
  2. spo customaction list -u https://contoso.sharepoint.com/
    office 365 cli list extensions

  3. Copy the ID
  4. To remove the extension from the site type:
    spo customaction remove -i 058140e3-0e37-44fc-a1d3-79c487d371a3 -u https://contoso.sharepoint.com/ --confirm
    replace the GUID after the –I option by the ID of your extension


No comments yet

Leave a Reply


Web developer focused on SharePoint branding, blogger, tech enthusiast. Travelling and sports are my addictions, knowledge and success are my daily motivations.