Office 365 CLI v1.16.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.16.0

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

Manage Microsoft Teams

More and more organizations use Microsoft Teams to facilitate communication and collaboration. As Teams are gaining popularity, you might need to manage some of their aspects like configurations or members in an automated way. In this release of the Office 365 CLI, we continued extending the list of commands for managing Microsoft Teams and their settings.

Create teams

To offer your users a more complete experience and better support their collaboration needs, you might want to create teams pre-configured with specific channels, tabs and apps. It all starts with creating the team. For this version of the Office 365 CLI, Balamurugan Kailasam contributed a command to create Microsoft Teams teams.

To create a team, execute:

graph teams add --name 'Architecture' --description 'Architecture Discussion'

In the future versions of the CLI, you can expect to be able to create Teams from a template. For now, you’d need to execute the different commands yourself.

Uninstall app from the particular team

As your teams evolve, their need might change and applications built and used previously, might no longer be sufficient. To simplify removing applications that are no longer needed, Vardhaman Deshpande contributed a command to uninstall applications from Microsoft Teams teams.

To uninstall the particular application from the given Microsoft Teams team, execute:

graph teams app uninstall --appId YzUyN2E0NzAtYTg4Mi00ODFjLTk4MWMtZWU2ZWZhYmE4NWM3IyM0ZDFlYTA0Ny1mMTk2LTQ1MGQtYjJlOS0wZDI4NTViYTA1YTY= --teamId 2609af39-7775-4f94-a3dc-0dd67657e900

Update channel settings

When configuring teams, it’s hard to predict upfront how the particular group of people will work together. It’s not uncommon for the originally created channels to be insufficient or to change over time. And if you have a number of teams created in the same way, updating all of them would quickly become tedious. To simplify updating channels, Rabia Williams contributed a command that you can use to update title and description of a channel.

To set a new name and description for a channel in a Microsoft Teams team, execute:

graph teams channel set --teamId "00000000-0000-0000-0000-000000000000" --channelName Reviews --newChannelName Projects --description "Channel for new projects"

Update guest settings

Using Microsoft Teams, your colleagues can collaborate with external users outside of your organization. To ensure that these external users work with Teams according to your organization’s policies, you can configure what these external users are allowed to do in the Teams they can access.

To allow external users to create and update channels, execute:

graph teams guestsettings set --teamId '00000000-0000-0000-0000-000000000000' --allowCreateUpdateChannels true

To disallow guests to delete channels, execute:

graph teams guestsettings set --teamId '00000000-0000-0000-0000-000000000000' --allowDeleteChannels false

List team’s tabs

Microsoft Teams offer your organization rich collaboration capabilities that can be further extended with custom applications. To learn more about which applications are used in your organization, you could regularly retrieve the list of tabs used in teams in your tenant. For this release of the Office 365 CLI, Thomy Gölles contributed a command to list all tabs used in the given channel of the particular Microsoft Teams team.

To list tabs used in the particular Microsoft Teams team’s channel, execute:

graph teams tab list --teamId 00000000-0000-0000-0000-000000000000 --channelId 19:00000000000000000000000000000000@thread.skype

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

Add users to Office 365 Groups and Microsoft Teams

If your organization uses Microsoft Teams or Office 365 Groups heavily, you might find yourself in a situation where you need to add users to newly created groups/teams. If it’s more than a handful of groups and users, the process will quickly become cumbersome. The good news is that you can automate it using the command contributed by Albert-Jan Schot.

To add a user to an Office 365 Group, execute:

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

The same way, you can add a user to a team:

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

Whether you use the groupId or the teamId option, their interchangeable and the result is the same.

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

Declare list items as records

Many organizations use SharePoint as a record management system. For this version of the Office 365 CLI, Arnie Raju contributed a command that allows you to declare a list item as a record. This command is invaluable if you want to automate the process or have a backlog of items to be defined as records in your environment.

To declare a list item as a record, execute:

spo listitem record declare --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --id 1

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

Create schema extensions

Using the Microsoft Graph, developers can store additional information about objects like users or messages. Developers can define the shape of this additional pieces of information through schema extensions. For this release of the Office 365 CLI, Yannick Plenevaux contributed a command to add a new schema extension to your environment.

To add a schema extension, execute:

graph schemaextension add --id MySchemaExtension --description "My schema extension" --targetTypes Group --owner 62375ab9-6b52-47ed-826b-58e47e0e304b --properties `"[{""name"":""myProp1"",""type"":""Integer""},{""name"":""myProp2"",""type"":""String""}]`

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

Bug fixes and improvements

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

Fixed adding sections and configuring headers of modern pages

The most important fixes in this release are related to recent changes in the modern pages’ DOM, which broke creating sections, configuring page headers and adding web parts. This version of the Office 365 CLI contains fixes for creating sections and configuring headers of modern pages. Fix for adding web parts will be included in the next version of the CLI.

Showing apps installed in the particular Microsoft Teams team

In the previous version of the Office 365 CLI, we introduced the ability to list Microsoft Teams apps available in your organization. In this release, we’ve extended the existing command to allow retrieving information about apps installed in the particular Microsoft Teams team.

To list apps installed in the particular Microsoft Teams team, execute:

graph teams app list --teamId 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55

Groupify your sites

If you’ve been using Office 365 for a while now, you might have a number of classic Team Sites. Unlike modern Team Sites, these classic site collections are nothing but SharePoint sites and don’t integrate with other services in Office 365. To prevent you from having to recreate these sites, Microsoft allows you to connect these classic sites to Office 365 Groups and other Office 365 services like Planner or Calendar.

In the previous version of the Office 365 CLI we’ve introduced the spo site office365group set command which connects a classic site collection to Office 365 Groups. To make the command easier discoverable, we’ve added the spo site groupify alias, following the commonly used name for the process of connecting existing Team Sites to Office 365 Groups.

Contributors

This release wouldn’t be possible without the help of (in alphabetical order) Hugo Bernier, Vardhaman Deshpande, Velin Georgiev, Thomas Gölles, Balamurugan Kailasam, Yannick Plenevaux, Arnie Raju, Albert-Jan Schot 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 over a year now. Over time we picked up some things that we think we could improve. We started to keep track of the ideas that we have for what we could do better to make the CLI easier to use. So far, we’ve decided to implement a few of them. If you use the Office 365 CLI, we’d love to hear from you if these improvements would be worth the effort and if there is anything else that we haven’t considered.

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: