New version of Office 365 CLI (v0.5.0)


We have just published a new version of the Office 365 CLI with more commands for working with site designs and site scripts, managing custom actions, site collections and lists.

Office 365 CLI

Office 365 CLI is a cross-platform CLI that allows you to manage various configuration settings of Office 365 no matter which operating system 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.

New version of Office 365 CLI - v0.5.0

Kicking off a new year, we have for you a new release of the Office 365 CLI (v0.5.0) packed with new capabilities for managing Office 365.

Working with site designs and site scripts

Site designs are the new way organizations can build custom site templates in Office 365. Using site designs, they can align with the preferred look and feel and structure as defined in the organizational information architecture.

Each site design uses one or more site scripts, that define the exact configuration steps that should be executed when provisioning the site using that design. These scripts are reusable across the different designs which makes it possible for organizations to ensure consistency for standard building blocks across the different designs.

When defining site designs, administrators can choose if the particular design should be available only to specific users. This is a highly desired capability that organizations have been asking for and which is now available as a part of site designs.

This version of the Office 365 CLI ships with a set of commands for creating and managing site scripts and site designs. Working with site designs is a topic of its own and we will publish more detailed information and examples shortly. Meanwhile, if you are already familiar with site designs, see the Office 365 CLI documentation at aka.ms/o365cli for more information on the commands and their capabilities.

Working with lists

Since they first became a part of SharePoint, lists were used for storing all kinds of information: tasks, events, business data or even application settings. Lists are a key piece of every information architecture based on SharePoint and you will find a number of them in each SharePoint portal.

In this release, Robert Schouten from Wortell contributed commands to get information about SharePoint lists. Using these commands, you can easily see which lists are present in your site (both visible and hidden!) and what different properties are set on a specific list.

To view all lists in your site using the Office 365 CLI, simply run:

o365 spo list list --webUrl https://contoso.sharepoint.com/sites/project-x

Robert is currently working on additional commands for managing SharePoint lists, which will help you automate deploying them as a part of your solutions when using the future versions of the Office 365 CLI.

For more information and examples of managing SharePoint lists using the Office 365 CLI, see the documentation at aka.ms/o365cli.

Managing custom actions

Custom actions have been a versatile capability for extending SharePoint for a while now. In the past, we would use custom actions for extending the ribbon, adding options to context menus or injecting scripts and manipulating DOM. While Microsoft recommends nowadays different patterns to achieve similar results, custom actions still have their place in extending SharePoint.

When building SharePoint Framework solutions, you use custom actions to enable your extensions on your sites. There is a specific format for how to enable a SharePoint Framework extension but it’s still based on the same custom action capability you used in the past.

For this new version of the Office 365 CLI, Velin Georgiev contributed commands to update and remove custom actions.

When enabling a SharePoint Framework extension in your site, as a part of its registration you can specify its properties. This is very convenient if you built a configurable extension and want to set it up for the specific site. Using the spo customaction set command you can update the registration information and the properties for that particular extension.

To update the properties of a SharePoint Framework extension enabled in your site using the Office 365 CLI, you would execute:

o365 spo customaction set --url https://contoso.sharepoint.com/sites/sub-wa --id 058140e3-0e37-44fc-a1d3-79c487d371a3 --clientSideComponentProperties '{"location":"Seattle"}'

Tip: you can get the ID of the custom action using the spo customaction list command.

If you want to disable the SharePoint Framework extension, simply remove the associated custom action using the spo customaction remove command.

For more information and examples of managing custom actions using the Office 365 CLI, see the documentation at aka.ms/o365cli.

Working with site collections

Microsoft is continuously improving modern sites, offering more and more capabilities every day. Still, there are many organizations heavily relying on classic sites. With every update, modern sites are becoming more of a viable option to migrate from classic sites. And the first step of each migration, is investigating what resources you are currently using.

For this release of the Office 365 CLI, Daniel Laskewitz from Sogeti, contributed a command to see which classic site collections you have in your tenant. Using the spo site classic list command, you can not only list all site collections, but also filter on a specific site template or URL.

For example, to see all classic project sites with the word project in the URL, using the Office 365 CLI you would execute:

o365 spo site classic list --webTemplate PROJECTSITE#0 --filter "Url -like 'project'"

If you want to get a better understanding of the different site collections in your Office 365 tenant, you will find the site collection commands provided with Office 365 CLI very helpful.

For more information and examples of working with site collections using the Office 365 CLI, see the documentation at aka.ms/o365cli.

The future: managing hub sites

During the last Ignite conference, Microsoft announced SharePoint hub sites: a new way of organizing related sites and managing information in SharePoint intranets built on Office 365. Using hub sites, organizations will be able to link related sites together and have them share consistent look and feel and navigation. Unlike subsites, hub sites are not based on hierarchy. Instead, users can connect sites to hub sites and easily change that association if need be, without costly migrations and dealing with broken links.

SharePoint hub sites

Hub sites are planned to be released to organizations using targeted release in the first half of 2018. As a part of preparation for their release, we added commands for managing hub sites in Office 365, so the moment hub sites become available in your tenant, you will be able to manage them using the Office 365 CLI. Please note, that these commands are based on a preview version of SharePoint APIs and could change in the future.

User guide

We appreciate your interest in the Office 365 CLI and want to help you as much as we can to make the best use of it and its capabilities. For that, we published a user guide that takes you through everything from installation to using the more advanced options of the CLI. Take a look at https://sharepoint.github.io/office365-cli/user-guide/installing-cli/ and don’t hesitate to reach out if you see any room for improvement.

Bug fixes and improvements

We are continuously listening to the feedback from the community and use it to improve the Office 365 CLI. In this release we included a number of bug fixes and minor improvements. For the full list of changes see the release notes in the Office 365 CLI documentation.

Sharing is caring

This release wouldn’t be possible without community contributions from Velin Georgiev, Robert Schouten, Daniel Laskewitz and many others who tried our betas and provided their feedback, as well as past contributions to other PnP efforts, such as PnP PowerShell, PnP Core Component and PnP JavaScript Core Library.

Next steps

Install the latest version of the Office 365 CLI from npm using:

npm i -g @pnp/office365-cli

or yarn:

yarn global add @pnp/office365-cli

We regularly publish beta version with the latest additions and improvements which you can install using:

npm i -g @pnp/office365-cli@next

If you have any feedback or questions, don’t hesitate to reach out on twitter with hashtag #Office365CLI or on the Office 365 CLI Gitter.

”Sharing is caring”

Others found also helpful: