Office 365 CLI v1.13.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.13.0

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

Get site script for a list

Using site scripts organizations can standardize creating sites to match their specific needs. To simplify creating site scripts, Microsoft recently introduced an API that allows you to extract site script from an existing list. For this release of the Office 365 CLI, Yannick Plenevaux contributed a command that allows you to use this API and extract site script from an existing list.

To extract site script from an existing list, execute:

spo list sitescript get --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle ContosoList

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

Get enabled site collection and site features

SharePoint Features have been introduced with SharePoint 2007 and are used to add new functionality to sites and site collections. Features can provision everything from a column to a list or even site. Nowadays, they’re not as common but still many new capabilities released by Microsoft are enabled on sites through Features.

To help you manage Features enabled in your SharePoint tenant, Simon Ågren contributed a command that allows you to see which Features are enabled on the specified site or site collection.

To see which Features are enabled on the specific site collection, execute:

spo feature list --url https://contoso.sharepoint.com/sites/test --scope Site

To get the list of Features enabled on the specific site, execute:

spo feature list --url https://contoso.sharepoint.com/sites/test --scope Web

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

Move files

If you’ve been using SharePoint for a longer period of time, the structure that you used to organize files in the past, might not be sufficient today. While you can easily move a handful of files from one location to another manually, moving hundreds or thousands will quickly become cumbersome. For this release of the Office 365 CLI, Simon Ågren contributed a command to move files between document libraries and sites.

To move a file from one location to another, execute:

spo file move --webUrl https://contoso.sharepoint.com/sites/test1 --sourceUrl /Shared%20Documents/sp1.pdf --targetUrl /sites/test2/Shared%20Documents/

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

Manage list views

By configuring list views, users can more easily find the relevant information. As a part of provisioning of your application, you might want to provision specific views in your lists. For this release of the Office 365 CLI, Velin Georgiev and Laurent Sittler contributed commands for managing list views.

To get the list of views configured on the specific list, execute:

spo list view list --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle Documents

To get more information about the specific list view, execute:

spo list view get --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --viewTitle 'All Items'

To remove the specific list view from the list, execute:

spo list view remove --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle Documents --viewTitle MyView

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

Manage Microsoft Teams team users

More and more organizations use Microsoft Teams to facilitate communication and collaboration. As Teams are gaining popularity, you might need to manage members and owners of Teams in an automated way.

For this release of the Office 365 CLI, Albert-Jan Schot contributed commands to get the list of users who belong to the specific Microsoft Teams team and to add new users to the team.

To list users who belong to the specific Microsoft Teams team, execute:

graph teams user list --teamId '00000000-0000-0000-0000-000000000000'

To add a user to the specific Microsoft Team team, execute:

graph teams user add --teamId '00000000-0000-0000-0000-000000000000' --userName 'anne.matthews@contoso.onmicrosoft.com'

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

Get Microsoft Teams team messages

As your organization uses Microsoft Teams, you might want to implement automation scenarios such as calculating sentiment of shared messages or extracting specific insights. To help you get started, for this release of the Office 365 CLI, Balamurugan Kailasam contributed a command that allows you to get messages from the specific Microsoft Teams team.

To get messages from the specific Microsoft Teams team, execute:

graph teams message list --teamId fce9e580-8bba-4638-ab5c-ab40016651e3 --channelId 19:eb30973b42a847a2a1df92d91e37c76a@thread.skype

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

Bug fixes and minor changes

Next to a number of new commands, this release of the Office 365 CLI contains a number of bug fixes and improvements.

Create site with the specific language

When creating a new site, you can now specify the language that this site should use. This extension was necessary to properly support provisioning the SharePoint Starter Kit.

Fixed bug in setting the order of client-side web parts

When provisioning client-side web parts using the Office 365 CLI, the specified order is now respected and the web part is placed in the correct location on the page.

Added authentication using certificate

When using the Office 365 CLI in automation scenarios, you can now login to Office 365 using a certificate. This is helpful for using the CLI for example in build pipelines.

Copying files and folders to other document libraries

Simon Ågren extended the spo file copy and spo folder copy commands, so that you can copy files and folders to other locations even if the schema of the target document library doesn’t match the source.

Retrieving list of sites associated with a hub site

Arjen Bloemsma extended the spo hubsite list so that when retrieving information about hub sites you can include the list of sites associated with each hub site.

Connecting to SPO-D

In this version of the Office 365 CLI, we’ve changed the logic for validating SharePoint URLs allowing users working with SharePoint Online Dedicated to use the Office 365 CLI as well.

Contributors

This release wouldn’t be possible without the help of (in alphabetical order) Arjen Bloemsma, Velin Georgiev, Balamurugan Kailasam, Yannick Plenevaux, Albert-Jan Schot, Laurent Sittler and Simon Ågren. 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.

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: