Office 365 CLI v1.18.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.18.0

Following our monthly release cadence, we’ve released a new version of the Office 365 CLI with some new capabilities.

Enable communication site features on the root site

As a part of the investments in modern SharePoint experiences, Microsoft announced last year the ability to turn the root site of an Office 365 tenant into a modern communication site. For many users, intranet starts with a landing page and you wouldn’t expect anything less from a modern intranet than a modern landing page.

Just recently, Microsoft started releasing the preview of this capability to tenants across the world. By enabling it, you in fact activate communication site features on the existing root site. At the moment of writing this article, this capability works only on the root site collection but in the future it could potentially work on other sites as well.

To enable communication site features on the root site of your tenant, execute:

spo site commsite enable --url https://contoso.sharepoint.com

For more information about working with modern sites using the Office 365 CLI, see the documentation at aka.ms/o365-cli.

Renew Office 365 Group’s expiration

Office 365 gives administrators the ability to configure expiration policy on Office 365 Groups and Microsoft Teams. Using these policies, administrators can automate removing stale groups. If the particular group is still needed, group owners can choose to extend its expiration period.

For this release of the Office 365 CLI, Rabia Williams contributed a command to extend the expiration of an Office 365 Group/Microsoft Team.

To extend the expiration of an Office 365 Group, execute:

graph o365group renew --id 28beab62-7540-4db1-a23f-29a6018a3848

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

Remove users from the specified Office 365 Group/Microsoft Teams

As your organization starts using Office 365 Groups and Microsoft Teams more and more, you will likely need to bulk-manage their users, and it’s not something you’d want to do manually. To help you automate managing users of your Microsoft Teams and Office 365 Groups, Albert-Jan Schot contributed a command to remove users from Office 365 Groups and Microsoft Teams.

To remove a user from an Office 365 Groups or Microsoft Team, execute:

graph o365group user remove --groupId '00000000-0000-0000-0000-000000000000' --userName 'anne.matthews@contoso.onmicrosoft.com'

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

Another feature that is a part of the modern SharePoint UX investments, is the footer, that can be displayed on modern communication sites. Using the footer, you can offer your colleagues easy access to frequent locations and applications in your organization.

For this release of the Office 365 CLI, Rajesh Sitaraman contributed a command that allows you to choose if the footer should be visible or not on the particular site.

To show the footer, execute:

spo web set --webUrl https://contoso.sharepoint.com/sites/team-a --footerEnabled true

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

Improved communication with Office 365

At the heart of the Office 365 CLI are web requests to the APIs of the different services in the Office 365. In this version of the Office 365 CLI, we’ve done a major refactoring of web requests.

First of all, we’ve added support for gzip compression which should decrease the amount of data sent over the wire. You should notice the difference especially when working with commands that return many results or send large payloads to Office 365.

Another refactoring that we’ve done, is adding support for properly handling throttling. This is crucial when you want to use the Office 365 CLI reliably in automation scenarios and want it to properly handle situations where the target Office 365 tenant is under heavy load and requires all applications to decrease their traffic.

Big thanks to Velin Georgiev for helping with this core refactoring that significantly improves the Office 365 CLI.

Contributors

This release wouldn’t be possible without the help of (in alphabetical order) Velin Georgiev, Albert-Jan Schot, Rajesh Sitaraman and Rabia Williams. 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.

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.

To make it easier for you to see how the CLI commands compare to the different PowerShell cmdlets, we’ve extended the comparison sheet with cmdlets for Flow, PowerApps and Teams.

Future improvements

CLI exists a year and a half now. Over time we picked up some things that we think we could improve. We’ve just refactored web requests and we’ve started working on simplifying logging in to Office 365. Next, we’ll work on aligning the names of the commands and there arguments to be consistent and more intuitive. If you use the Office 365 CLI, we’d love to hear from you if there is anything else that we should consider.

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: