Automating SharePoint with PnP Powershell Tools
Automate SharePoint List, Site, Content Type Creation & More!
Microsoft has just updated the PnP tools for SharePoint Online and On Premise. These tools give you much greater control over your deployments (especially SP Online) for example some of the cmdlets available are as follows,
- Lists
- New-PnPList – Creates a new list
- Add‑PnPListItem – Adds an item to a list
- Set‑PnPListItem – Updates a list item
- Content Types
- Add‑PnPContentType – Adds a new content type
- Get‑PnPContentType – Retrieves a content type
- Branding
- Add‑PnPNavigationNode – Adds a menu item to either the quicklaunch or top navigation
- Set‑PnPTheme – Sets the theme of the current web.
- Set‑PnPMasterPage – Sets the default master page of the current web.
A full list of all the available cmdlets can be found on Microsoft’s Powershell overview page.
These cmdlets are a brilliant way to provide automation components and integration with various applications. For example these could be used to automatically create a SharePoint site based on a template. Valto use this internally to create a SharePoint site for each customer once we add them to our Finance/CRM Package.
To get started with the scripts you can download them from GitHub.
People that are using Windows 10, a better way would be to use the Windows Management Framework and run the command below (For SharePoint Online)
Once you’re all setup its a matter of running the typical Powershell commands to get connected to your tenant as below,
The URL above explains all of the cmdlets that are available.
Over the coming weeks Valto will be building some example automation scripts that may be useful to your SharePoint deployments including some of the examples below,
- Full creation of a SharePoint Site, sub sites and lists. This may be useful for building demo environments.
- Automatically applying branding packages to various subsites.
- Creating reusable lists for forms and workflow processes you may have.
If you have any questions about the scripts or would like to see some specific automation scripts let me know in the comments section below.
Share this entry