Lately I have been contributing to the Office 365 CLI project on GitHub. The Office 365 CLI allows you to manage different settings of your Microsoft Office 365 tenant on any platform. CLI stands for a command-line interface or command language interpreter. This means that a user performs commands through a shell or a computer program. In the case of the Office 365 CLI commands in order to manage your Microsoft Office 365 tenant.

The Office 365 CLI is distributed as an NPM package. To use it, install it globally using:

npm i -g @pnp/office365-cli

or using yarn:

yarn global add @pnp/office365-cli

More information on Office 365 CLI can be found here.

SharePoint Patterns and Practices

Office 365 CLI is an open-source project driven by the SharePoint Patterns and Practices initiative. The project is built and managed publicly on GitHub at and accepts community contributions. We would encourage you to try it and tell us what you think. We would also love your help! We have a number of feature requests that are a good starting point to contribute to the project.

“Sharing is caring”

SharePoint PnP team

When I first read about the Office 365 CLI initiative as a Mac user and using Windows VMs in order to run PowerShell Commands for Office 365 management, I was triggered to learn more about it. Last december I started contributing to the project. The following paragraphs will go in to more detail on how you could contribute to the project.


The Office 365 project contains all the basic steps and documentation in order to start contributing to the project. I will provide a short guide with links to the original documentation. A good starting point is the Contributing guide within the GitHub project. This will give you directions on the types of contributions, some tips and do’s and don’ts. In order to start contributing follow the steps below:

  1. Use the project guide information ‘Minimal path to awesome‘ in order to setup your development environment. More information on forking a project can be found here.
  2. Take a look at the issue list, to pick an issue to contribute on. The issues are tagged with ‘help wanted‘. Some issues are also tagged with ‘good first issue‘ and are great issues to start contributing on. If you want to contribute, but there is no issue yet for it? Please add a new issue for it. Please leave a message within the issue when  you want to pick it up.
  3. Before contributing:
    • ensure that the dev branch on your fork is in sync with the original office365-cli repository:
      # assuming you're in the folder of your locally cloned fork....
      git checkout dev
      # assuming you have a remote named `upstream` pointing to the official **office365-cli** repo
      git fetch upstream
      # update your local dev to be a mirror of what's in the main repo
      git pull --rebase upstream dev
    • create a feature branch for your change. If you’ll get stuck on an issue or merging your PR will take a while, this will allow you to have a clean dev branch that you can use for contributing other changes
      git checkout -b my-contribution
  4. When adding a new command, this guide will help you get started. Develop your command, your changes, tests and documentation.
  5. Build and test your project using:
    npm run build
    npm run test
  6. If your project builds, all tests pass and there is 100% coverage, you are ready to submit a pull request! Make sure you fetch your upstream and rebase it to your dev branch.

SharePoint List contributions

The contributions I did lately were focussed on SharePoint List contributions. I added new commands in order to Get a lis from a site, List all Lists in a site, Add a new List to a site and Set/Update properties on a List in a site:

  • o365$ spo list get
  • o365$ spo list list
  • o365$ spo list add
  • o365$ spo list set

With above commands you can use the Office 365 CLI to manage your lists in SharePoint Online.

In order to get help on the above commands how to use them type:

help <command>

Before using above commands your should first connect to SharePoint Online Service:

spo connect <url>

When using other services within Office 365, you should explicitly connect to that service first. More information on how to connect to Office 365 can be found here.

To authorize for communicating with Office 365 API, the Office 365 CLI uses Azure AD OAuth 2.0 device flow. After executing the connect command for the particular service, the CLI will initiate the authorization flow. In the terminal, you will see the device code that you have to enter at which will complete the authorization flow and grant the CLI access to communicate with Office 365 on your behalf.

Screen Shot 2018-02-07 at 17.40.07


Contributing to the Office 365 CLI project is great fun! This blog post will give you some hands-on instructions and guidance on how to start contributing to the project. I hope to see you soon contributing on the project!

“Sharing is caring”