SharePoint Online Logo

Automate SharePoint

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 here https://msdn.microsoft.com/en-us/pnp_powershell/pnp-powershell-overview.

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 the following page,

https://github.com/officedev/pnp-powershell/releases

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)

https://msdn.microsoft.com/en-us/pnp_powershell/pnp-powershell-overview

Once you’re all setup its a matter of running the typical Powershell commands to get connected to your tenant as below,

Connect-PnPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)

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.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *