Episode #115 – PnP ❤ Microsoft Lists
Here you can find the transcript of Episode #115 of PiaSys TechBites.
Welcome back to PiaSys Tech Bites. Today, I want to talk with you about Microsoft Lists, the new service recently introduced by Microsoft in the Microsoft 365 offering. With Microsoft Lists you can create, share, and track items and activities through lists. Under the cover, there is the SharePoint Online list infrastructure, and Microsoft Lists just provides a smarter, nicer, and modern UI and UX on top of the SharePoint Online lists infrastructure. You can create personal lists, which will be stored as lists in the OneDrive for Business, a site collection of every single user. Or you can create site lists, which will be stored as lists in any modern site collection of SharePoint Online. PnP really loves Microsoft’s list, and that’s why using PnP PowerShell you can easily manage lists and items of Microsoft’s lists, as well as you can use the PnP Provisioning Engine to extract or provision a template of a Microsoft List.
So, let’s move to the demo environment, and let’s see that in practice. So, in order to access Microsoft Lists, you need to click on this new icon that you can see right here, the rainbow. And from here, you can play with the already created lists or you can create new lists. So, for example, let’s say that I want to create a new list, which can be, for example, a recruitment tracker list. This will be how the list will look like. There is just a preview of the list. I can use this template. I can choose this name, which is totally okay for me, and I can provide a description. I can choose the color of my list and an icon if I like, and then it will be in my list or I can place it in a specific target site collection. I will use my list right now and click on create.
Now you will see that, in a matter of two seconds, we will have our list ready to go and created. Now, as you can see, this is under my site, so the OneDrive for Business site collection of my current user. We can easily do something like that. I can switch to PowerShell and I can say with PnP PowerShell, Connect-PnPOnline. I can provide the URL of my OneDrive for Business site collection, so, this one. And I can provide a set of credentials to access the target environment. Once I’ve done that, I’m connected to the target list. So, I can say, Get-PnPList for example. And we can see that somewhere we will have the recruitment tracker list. Here it is. So, we can get the list and we can say $list = Get-PnPList, and I can provide the name of the list that I want to retrieve.
And this will be the “recruitment tracker” list that I have in my OneDrive for Business for Microsoft Lists. Now I can, for example, get the PnP property for that list. So I will provide the client object, which is the list object that I just retrieved, and I can select to retrieve the ContentTypes property. Why? Because I want to show you that I have a set of content types in that list, including the recruitment tracker content type, which is the one I want to use whenever I need to create a new item in this list. So, for example, I can say, $list.ContentTypes. I will get the very first and unique content type in my list. I will get the ID and I will get the StringValue of that content type ID. And as you can see, this is the content type ID of the recruitment tracker item, which you can also see from the UI of Microsoft Lists if you go to the list settings right here.
And as you can see, and as you can recognize, here’s the nice UI of SharePoint Online, nothing more than that. So, I can go back to my list and still using PnP PowerShell, I can, for example, say Add-PnPListItem, and I will add a new item to my target list of recruitment tracker. I will provide, as the content type for the item, the content type ID that I just retrieved from the previous query. So, this one. And I will say that the values for my fields will be, and I can just, for the sake of simplicity, provide just a Title field to keep it simple, “Inserted via PnP PowerShell”. Let’s do that.
In a matter of seconds, here we are. We inserted a new item and as you will see in the Microsoft List, we will soon see a new item popping up in the UI. So, if I go back here, you see the UI is showing me the new item inserted via PnP PowerShell, which is really cool and interesting. But you can do more. So, let me go back to the homepage of Microsoft Lists and let me create a new list. For example, an employee onboarding list. This will be again, the preview. I will use this template. And for example, I will target a site like, let’s say, for example, the sample of… Let’s use this one: “PnPjs demos”, that’s okay. I create this list, employee onboarding, which will be created in a target site collection. As you can see now, I’m under SharePoint Online slash sites.
I’m in the PnPjs demo site. Well, I can again use PnP PowerShell to connect that to this target site. So, Connect-PnPOnline, will provide again the URL and the credentials, as like as before. And once I’ve done that, I can say Get-PnPProvisioningTemplate. I can provide, as the outputted file right here, which will be employee.xml, for example. And I will say that I want to manage the handler for lists only, and I want to extract the list called employee onboarding. So, I will simply extract that specific list, the definition. By doing that, I can open visual studio code and show you that we will get back a PnP Provisioning template, which will define the structure of that specific employee onboarding list in SharePoint Online, which is also a Microsoft Lists list.
In a matter of a few seconds, the template will be generated. And as soon as we will be ready, I will show you the content. And here we are, on the XML file using Visual Studio Code. As you can see, it’s nothing more than a PnP provisioning template, where I have the definition of my employee onboarding, with its content type and everything else. So, why not doing something like that? We can connect to another site, which I can eventually create or reuse. In my scenario, I have a PiaSys Tech Bites Demo site. And in this site, I’m going to provision that specific template. So, what I can do here is Connect-PnPOnline, providing the URL of the site, again providing the credentials from the credential manager.
And once I’ve done that, I can apply the PnP provisioning template that I created before, and I can say that the path of my template is dot employee dot XML. Let’s do that. And in a matter of two seconds, we will have the employee onboarding list available in the target site. The interesting part of this story is that we will be able to see that list also in Microsoft Lists. So, in a matter of two seconds, the provisioning will be completed and we will be able to see our employee onboarding list in the SharePoint UI, as well as in the Microsoft Lists UI. A few more seconds, and here we are. So, I can go to site contents and I can see the employee onboarding lists. And I can see that if I go to Microsoft Lists and I refresh here, I will be able soon to see that we have the employee onboarding list also in our target site. Just to speed up the process because there is some caching in between, let me access this list.
This is the list that I see from a SharePoint Online point of view. But if I go back to Microsoft Lists I should be able to see… And here it is. The employee onboarding in PiaSys Tech Bites Demos. So, I click on it and I will see the same list with the UI of Microsoft Lists. Really simple, really straightforward. And as you can see, PnP really loves Microsoft Lists. Like always, thank you for watching this video. I hope you found it interesting, and I’m really looking forward to seeing you next week. Thank you.