CLI for Microsoft 365 v6.7
We’ve published a new minor version of CLI for Microsoft 365.
CLI for Microsoft 365 is a cross-platform command-line tool. It helps you manage your Microsoft 365 tenant and SharePoint Framework projects. No matter which operating system or shell you use.
Read the release notes in full for all new features and improvements.
What’s new
Retrieving Application Customizers
Our work on simplifying working with SharePoint Framework extensions, like Application Customizers, is steadily moving forward. Today we’re launching the ability to retrieve a specific Application Customizer, regardless of where they are registered in a SharePoint site:
Retrieve an application customizer by title:
m365 spo applicationcustomizer get --title "Some customizer" --webUrl https://contoso.sharepoint.com/sites/sales
Retrieve an application customizer, registered on site-level, by clientSideComponentId:
m365 spo applicationcustomizer get --clientSideComponentId 7096cded-b83d-4eab-96f0-df477ed7c0bc --webUrl https://contoso.sharepoint.com/sites/sales --scope site
Clearing the SharePoint site recycle bin
Working with the recycle bin programmatically has become easier as well. You can now clear a site recycle bin with a simple one-liner.
Clear all items from the first-stage recycle bin:
m365 spo site recyclebinitem clear --siteUrl https://contoso.sharepoint.com/sites/sales
Clear all items from the second-stage recycle bin:
m365 spo site recyclebinitem clear --siteUrl https://contoso.sharepoint.com/sites/sales --secondary
What’s changed
Retrieving items from SharePoint lists and libraries
We’ve shipped several enhancements that are very useful when working with lists and libraries on SharePoint. Instead of a limited set, you can now get all list items from large lists. We also implemented extra options to retrieve specific file and folder fields, and the ability to filter files and folders in a given library.
Get all items in a list, regardless of the list size:
m365 spo listitem list --listTitle "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x
Only get the first 100 items in a list:
m365 spo listitem list --listTitle "Demo List" --webUrl https://contoso.sharepoint.com/sites/project-x --pageSize 100
Retrieve all files from a folder for which the filename starts with the word ‘Demo’:
m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --filter "startswith(Name, 'Demo')" --recursive
Retrieve all files from a folder and retrieve the list item Id as well as the filename:
m365 spo file list --webUrl https://contoso.sharepoint.com/sites/project-x --folder 'Shared Documents' --fields "ListItemAllFields/Id,Name" --recursive
The same works when retrieving folders:
Retrieve all folders for which the folder name starts with the word ‘Demo’:
m365 spo folder list --webUrl https://contoso.sharepoint.com/sites/project-x --parentFolderUrl 'Shared Documents' --filter "startswith(Name, 'Demo')" --recursive
Updating Azure AD Users
You could already update user information for Azure AD users. We’ve made managing users even easier, by adding a lot of new options. You can now update the user company name, preferred language, usage location, job title and office location and more.
Update multiple properties of a user:
m365 aad user set --userPrincipalName john@contoso.onmicrosoft.com --firstName John --lastName Doe --jobTitle "Sales Manager" --companyName Contoso --department Sales --officeLocation "New York"
Update a user with a manager:
m365 aad user set --userName "john@contoso.onmicrosoft.com" --managerUserName "adele@contoso.com"
Enhanced prompts
When you run a command using the CLI for Microsoft 365, and forget to add a required option, the CLI can prompt you to enter a value for that option. (Tip: To use this feature, you’ll need to set the config key prompt
to true
, as it’s false
by default.) But some commands may have options where at least one is required. For example, the user has to define either a userName or an id, but not both. We’ve enhanced the prompt feature to include these situations. Here’s a gif of how that works in practice:
And there’s more
We’ve been working tirelessly to enhance our capabilities. How about support for non-public clouds? We’ve now got it! How about getting extra information when listing flow runs? It’s now included.
Take a look at our release notes below for the full rundown of everything we’ve done. Check it out! We’re very curious to hear your experiences.
What’s next
Here are some things that we are currently working on.
🌶️ CLI assistant
In the previous release, we introduced a chat-based search tool, powered by Mendable, to make it easier to find out how you can achieve your aims using the CLI for Microsoft 365. But we are not stopping there. We’re currently in the process of integrating this same chat-based experience into the CLI itself! You will be able to ask your questions to this new CLI assistant without even leaving your terminal! The assistant will search the documentation for you and explain how you can achieve your scenario, it will also list links to the sources where it found what it’s saying, for a seamless switch to the CLI for Microsoft 365 website in the browser.
🥁 You’ll just need to wait a little bit for this functionality to be released.
More commands and enhancements
We are always looking to add more commands to CLI for Microsoft 365.
We are busy implementing commands across several Microsoft 365 services, such as Power Platform, SharePoint Online, and Microsoft Purview.
If you have any ideas or suggestions for new commands, please let us know by creating a new issue in the GitHub Issues list, or reaching out to us on our community Discord server to discuss.
Contributors
This release wouldn’t be possible without the help of (in alphabetical order):
- Adam Wójcik
- Ganesh Sanap
- Jasey Waegebaert
- Martin Lingstuyl
- Mathijs Verbeeck
- Milan Holemans
- Nanddeep Nachan
- Nico De Cleyre
- Nicolas Camara
- Saurabh K. Tripathi
- Waldek Mastykarz
Thank you all for the time you chose to spend on CLI for Microsoft 365 and for your help to advance it!
High fives
CLI for Microsoft 365 wouldn’t be where it is today if it weren’t for our users who provide us with feedback. High fives to the following people who took the time to share their feedback and ideas for improvement with us (in alphabetical order):
Try it today!
Get the latest release of CLI for Microsoft 365 from npm by executing:
npm i -g @pnp/cli-microsoft365
Or, you can get the latest release from Docker by executing:
docker run --rm -it m365pnp/cli-microsoft365:latest
Need more info?
If you need more help getting started or want more details about the commands, architecture, or project, go to aka.ms/cli-m365.
Get in touch!
If you see any room for improvement, please, don’t hesitate to reach out to us either on GitHub, Discord, or Twitter.