Find, Create and Fill a Video playlist in SharePoint Online with PowerShell

Here are three nice tips for handling the new playlists for videos in SharePoint Online. These could become handy during or after your MS Stream migration into SharePoint and OneDrive.

Find all playlists

You can find all playlists via search using the managed property ListTemplateTypeId and a specific GUID. See

https://yourtenant.sharepoint.com/_layouts/15/search.aspx/?q=ListTemplateTypeId%3A3a867b4a-7429-0e1a-b02e-bf4b240ff1ce

KQL Query:

ListTemplateTypeId:3a867b4a-7429-0e1a-b02e-bf4b240ff1ce

Create playlist and set TemplateTypeId:

You must use the normal commands to get the PnP list template of a playlist created throught the GUI in order to create a playlist via PowerShell. You can find out how to do so online, for example here.

However, the TemplateTypeId field of the list cannot be set via a PnP Provisioning template. And if it's not set you will not find the list via search with the query above, but also the Playlist view of the list will not work correctly. You need to set the TemplateTypeId field using powershell with these commands:

$list = Get-PnPList -Identity "Playlist"; $list.TemplateTypeId = "3a867b4a-7429-0e1a-b02e-bf4b240ff1ce"; $list.Update(); Invoke-PnPQuery;

Because getting the pnp template and applying it is also non-trivial, you can check them out here:

Creating an item in a video playlist

Creating an item in a list using PowerShell is normally quite simple. However, the video playlist template uses a number of fields that are not even visible in the GUI and you need quite a lot of information about the video file in order to fill the fields. Using the browsers dev tool I found out what data to use during the list item creation to be able to create an item. The script works, however the final step to add the list item does still give an error. You can suppress that by adding parameter -ErrorAction SilentlyContinue to the Add-PnPListItem command. Should you find a way to remove the error altogether, let me know!

See this PowerShell to create an item in a video Playlist.

Sorry for the bad formatting of the PowerShell in markdown, to do that correctly still goes over my head :D

Here's a screenshot of a programmatically created playlist and programmatically added items: