Office 365 CLI v1.12.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.12.0
Following our monthly release cadence, we've released a new version of the Office 365 CLI with some new capabilities.
Add text to modern page
More and more organizations are moving their portals and sites to the modern SharePoint experience which is more user-friendly and suitable for a wider range of use cases, including mobile devices. In automation scenarios, you might want to provision modern pages with some text on them. Using the work of Yannick Plenevaux I've extended the Office 365 CLI with support for adding text to modern pages.
To add text to a modern page, execute:
spo page text add --webUrl https://contoso.sharepoint.com/sites/a-team --pageName page.aspx --text 'Hello world'
For more information about working with modern pages using the Office 365 CLI, see the documentation at aka.ms/o365-cli.
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 one folder with files from one location to another manually, moving multiple folders, will quickly become cumbersome. For this release of the Office 365 CLI, Simon Ågren contributed a command to move folders between document libraries and sites.
To move folder from one location to another, execute:
spo folder move --webUrl https://contoso.sharepoint.com/sites/test1 --sourceUrl /Shared%20Documents/MyFolder --targetUrl /sites/test2/Shared%20Documents/
Simon is working on more commands related to managing files and folders in SharePoint, which will be available in the future versions of the Office 365 CLI.
For more information about managing folders using the Office 365 CLI, see the documentation at aka.ms/o365-cli.
Support for site collection app catalogs
A while ago already, Microsoft introduced support for site collection app catalogs as a way to help organizations manage their SharePoint solutions. By deploying their applications to site collection app catalogs, organizations can make the application available only on that specific site. Site collection app catalogs are disabled by default and can be enabled on specific sites by tenant admins.
For this release of the Office 365 CLI, Velin Georgiev and Andrew Connell updated a number of CLI commands that allow users to manage apps in site collection app catalogs. All app-related commands in the CLI now support working with apps deployed to site collection app catalogs.
For more information about managing apps using the Office 365 CLI, see the documentation at aka.ms/o365-cli.
Bug fixes and minor changes
While using the Office 365 CLI in the PnP SharePoint Starter Kit provisioning script, I noticed that the CLI was setting incorrect expiration date on retrieved access tokens. As a result, on each command execution, the CLI would retrieve a new access token, which added unnecessary overhead to running commands. With the fix applied to this release, the CLI correctly re-uses previously access tokens as long as they're valid.
Setup script for the PnP SharePoint Starter Kit
The cross-platform setup script for the PnP SharePoint Starter Kit is ready!
A while back already, 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.
For a while now, I've been working on a cross-platform setup script based on Bash and Office 365 CLI. With the commands introduced in this release of the Office 365 CLI, we were finally able to complete all prerequisites and finish the setup script. A few people were kind enough to try the setup script and provide their feedback. It's great to see that now also users on non-Windows OSes can preview the Starter Kit!
This release wouldn't be possible without the help of (in alphabetical order) Andrew Connell, Velin Georgiev, Yannick Plenevaux, 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.
Setup script for the PnP SharePoint Starter Kit
As the PnP SharePoint Starter Kit evolves and more users set it up using the cross-platform setup script, we will likely be extending both the script and the Office 365 CLI to cover the provisioning gaps and fix any unintended behavior we spot.
The setup script is a great way to see how Office 365 CLI would fit in a real-life Bash script but also to understand how it could be improved to make the usage in automation scenarios as simple as possible.
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.