Microsoft gives us a few options for managing our SharePoint Online environments. We can use the SharePoint Admin center, REST APIs, the CSOM and the SharePoint Online PowerShell. To fill the gaps, the SharePoint PnP group has created PowerShell cmdlets that cover additional tasks not covered by the Microsoft provided PowerShell. While these are good options, they aren’t very friendly to those who aren’t on the Windows platform. These two PowerShell options don’t leverage the cross-platform PowerShell, rather they are only available for the Windows platform.
Introducing the Office 365 CLI
Late last year, fellow MVP Waldek Mastykarz & I started working on an effort to solve this with the Office 365 CLI. This is natively cross-platform command line interface, similar to the Azure CLI, you can install this on any platform (Windows, MacOS or Linux) and manage your Office 365 investments from the command line. When it was initially introduced, many thought it was a Microsoft provided option, when in reality its 100% community driven and run through the SharePoint PnP group. Waldek gets most of the credit here… he did all the work of standing up the project and acts as the project manager addressing community contributions, pull requests, and publishing new versions.
Webinar - February 13, 2018: Introducing and Using the Office 365 CLI with MVP Waldek Mastykarz
Office 365 & SharePoint Online provide multiple management options. From the tenant to site level, developers and administrators can leverage browser-based administrative interfaces to perform many tasks. However, some tasks can only be implemented via an API or the command line.
The Office 365 CLI, a cross-platform and community-driven project from the SharePoint PnP team, expands these command line tasks beyond the Windows platform and existing PowerShell options.
In this webinar, join MVP and long-time SharePoint developer Andrew Connell (AC) from Voitanos with MVP Waldek Mastykarz from Rencore for a 30-minute discussion and demonstration heavy webinar on the Office 365 CLI.
This webinar will be recorded for those who cannot attend the live session & published to the Voitanos blog
At the present time the Office 365 CLI has commands for managing your SharePoint related Azure AD tasks and many SharePoint Online tasks. While it’s still under development, the community is working hard to and more and more features with the goal of having 100% parity with the Microsoft provided SharePoint Online PowerShell module & PnP PowerShell module.
In this post I want to highlight on one capability I recently contributed to the Office 365 CLI: managing site collection app catalogs .
Manage SharePoint Site Collection App Catalogs with the Office 365 CLI
Late in 2017, Microsoft introduced a new capability in SharePoint Online: Site Collection App Catalogs! This allows you to deploy a customization that is only installable and thus usable within the site collection and not in other site collections in the tenant.
The site collection app catalogs aren’t created by default in your site collections, nor can you create them in the browser-based interface. Microsoft has provided cmdlets in the SharePoint Online PowerShell module for creating & removing app catalogs from site collections.
If you’re not on Windows (because the SharePoint Online PowerShell only works on Windows), or if you prefer a CLI approach over PowerShell, you can now use the Office 365 CLI to perform these tasks with two commands I recently contributed to the project.
Add Site Collection App Catalogs
You’ll first need to make sure the Office 365 CLI is installed on your machine. Verify this by running
office365 from the command line. If you get an error, follow the steps here to get it installed.
Once you start the Office 365 CLI, again by running
office365 fro the command line, you need to connect to your SharePoint Online tenant:
Then, to enable the site collection app catalog, use the spo site appcatalog add command:
This process is fairly immediate so if you go back to your SharePoint Online site, navigate to the Site Contents library, you should see your app catalog!
Removing Site Collection App Catalogs
The Office 365 CLI also supports removing the app catalog… but you aren’t really removing anything. The naming is a bit misleading.
When you remove the app catalog, you are really just disabling it, telling SharePoint to no longer treat the app catalog as an app catalog. Behind the scenes, SharePoint just treats the library like a normal SharePoint document library.
Again, it’s pretty simple using the spo site appcatalog remove command: