Office 365 CLI v1.8.0


We’ve just published a new version of the Office 365 CLI with new commands for working with and managing Office 365 tenants and SharePoint Framework projects on any platform.

Manage Office 365 and SharePoint Framework projects on any platform

Office 365 CLI is a cross-platform CLI that allows you to manage various configuration settings of Office 365 and SharePoint Framework projects no matter which operating system or shell you use.

While building solutions for Office 365 expands beyond the Windows operating system, managing many of the platform settings is possible only through PowerShell on Windows. As more and more users work on non-Windows machines, it’s inconvenient for them to have to use a Windows virtual machine to configure their tenants. With the Office 365 CLI you can configure your tenant no matter which operating system you use. Additionally, using the Office 365 CLI, you can manage your SharePoint Framework projects.

New version of Office 365 CLI - v1.8.0

New version of the Office 365 CLI with a few new commands and improved support for upgrading SharePoint Framework projects.

Update tenant settings

Office 365 offers you a wide-set of configuration settings which allow you to tailor it to your specific needs. Many of these settings are defined through tenant properties. For this release of the Office 365 CLI, Velin Georgiev contributed a command that allows you to configure these settings. For example, to hide the Feedback button in SharePoint execute:

spo tenant settings set --UserVoiceForFeedbackEnabled true

For more information about managing tenant settings using the Office 365 CLI and the list of available options, see the documentation at aka.ms/o365-cli.

Manage taxonomy

SharePoint taxonomy is one of the most popular content management capabilities. Not only it’s used for tagging content but also for storing hierarchical information such as navigation. In this version of the Office 365 CLI, we’re proud to introduce additional commands for managing SharePoint taxonomy.

To add a taxonomy term group, execute:

spo term group add --name PnPTermSets

To add a taxonomy term set, execute:

spo term set add --name PnP-Organizations --termGroupName PnPTermSets

To get information about existing term sets, execute:

spo term set list --termGroupName PnPTermSets

To add a taxonomy term, execute:

spo term add --name IT --termSetName Department --termGroupName People

To get information about existing terms, execute:

spo term list --termGroupName PnPTermSets --termSetName PnP-Organizations

For more information about managing SharePoint taxonomy using the Office 365 CLI, see the documentation at aka.ms/o365-cli.

Get information about webhooks

When building SharePoint applications, a common requirement is to be able to respond to activities in SharePoint, such as creating or editing a list item or document. In SharePoint Online, next to using Remote Event Receivers, you can use webhooks to get notified of changes in SharePoint content and configuration.

For this version of the Office 365 CLI, Arjen Bloemsma continued his work on the support for webhooks, and contributed a command that allows you to get information about the specific webhook.

To get information about the specific webhook, execute:

spo list webhook get --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf --id cc27a922-8224-4296-90a5-ebbc54da2e85

Arjen is working on additional commands that will allow you to create and edit webhooks.

For more information about managing webhooks using the Office 365 CLI, see the documentation at aka.ms/o365-cli.

Manage site classification

Office 365 allows you to enable classification for your SharePoint sites. This is an important capability that allows organization to improve their information security posture.

For this version of the Office 365 CLI, Albert-Jan Schot contributed commands to enable and disable SharePoint site classification.

To enable site classification, execute:

graph siteclassification enable --classifications "High, Medium, Low" --defaultClassification "Medium"

To disable site classification, execute:

graph siteclassification disable

For more information about managing site classification using the Office 365 CLI, see the documentation at aka.ms/o365-cli.

Add Microsoft Teams channel

More and more organizations use Microsoft Teams to facilitate their internal communication. Not surprisingly, more digital workplace solutions include Teams and provision a preconfigured set of teams and channels.

For this release of the Office 365 CLI, Balamurugan Kailasam contributed a command to add a new channel to an existing Micrsoft Teams team.

To add a channel to a team, execute:

graph teams channel add --teamId 6703ac8a-c49b-4fd4-8223-28f0ac3a6402 --name office365cli --description development

For more information about managing Microsoft Teams using the Office 365 CLI, see the documentation at aka.ms/o365-cli.

Faster in non-immersive mode

You can use the Office 365 CLI in two modes: immersive and non-immersive. In the immersive mode, you start the CLI as an application. It starts a new command prompt that allows you to execute CLI commands. In the non-immersive mode, you can execute Office 365 CLI commands directly from the shell. This is perfect for quickly executing a single command or for building scripts.

Initially, each time you would execute an Office 365 CLI in the non-immersive mode, it would load all commands and then execute the specified command. As we’ve added more commands, the startup time started to cause a noticeable delay. So in this version, we changed how commands are loaded in the CLI. If you execute it in the non-immersive mode, the CLI will try to deduct which command you want to execute. If it succeeds, it will load only this one command and execute it. If it doesn’t find a match, it will load all commands and show the help. With this change, the CLI executes faster allowing you to be more productive.

Contributors

This release wouldn’t be possible without the help of (in alphabetical order) Arjen Bloemsma, Velin Georgiev, Balamurugan Kailasam and Albert-Jan Schot. Thank you all for the time you chose to spend on the Office 365 CLI and your help to advance it!

Work in progress

Here are some things that we’re currently working on.

Setup script for the PnP SharePoint Starter Kit

Recently, the SharePoint PnP team released the SharePoint Starter Kit: an end-to-end solution illustrating how to use the latest capabilities to build a modern intranet on Office 365. This starter kit will keep evolving as new capabilities are added to Office 365.

To help you setup the solution in your tenant, the PnP team released a setup script based on PnP PowerShell. Due to the current limitations of PnP PowerShell this script can be used only on Windows.

What if we had an equivalent script built in bash, using the Office 365 CLI which you could use on any platform?

I’ve already started working on this script in a separate repo. The basic structure is almost in place and ready for external contributions. Would you be interested in helping out with it?

More commands, what else

Office 365 is evolving and new capabilities are being released every day. With the Office 365 CLI we aim to help you manage your tenant on any platform in a consistent way, no matter which part of Office 365 you interact with. While we keep adding new commands to the Office 365 CLI each release, we still barely scratched the surface with what’s possible in Office 365. In the upcoming versions of the Office 365 CLI, you can expect us to add more commands across the different workloads in Office 365.

Try it today

Get the latest release of the Office 365 CLI from npm by executing in the command line:

npm i -g @pnp/office365-cli

If you need more help getting started or want more details about the commands, the architecture or the project, go to aka.ms/o365cli. If you see any room for improvement, please, don’t hesitate to reach out to us either on GitHub, on twitter with the #office365cli hashtag or on gitter.

Others found also helpful: