Skip to main content

Posts

Showing posts with the label #ITAdmin

Automate SharePoint Site Creation with PowerShell and PnP

Creating new SharePoint sites while maintaining a consistent look and feel can be challenging. Fortunately, with PowerShell and the PnP (Patterns and Practices) framework, we can automate the process of backing up a site template and applying it to a new site. This blog post will guide you through the necessary steps. Prerequisites Before you begin, ensure you have the following: SharePoint Online Management Shell PnP PowerShell module installed Appropriate permissions to access the SharePoint site and admin center Step-by-Step Guide 1. Backup the Site Template First, you need to connect to the source site and back up its template. # Source Site URL input $SourceSiteURL = Read-Host "Enter Source Site URL" # Path to XML file $SchmaXMLPath = " " # Connect to PnP Online to take template backup Connect-PnPOnline -Url $SourceSiteURL -Interactive # Get Site Schema and save to file Get-P

Identifying Stream Web Parts in SharePoint Pages

Microsoft recently announced that they are discontinuing the classic Stream and introducing a new version. This change necessitates the identification of Stream web parts across SharePoint pages within your organization. To help with this transition, you can use a PowerShell script to scan your SharePoint sites for any Stream web parts that may be in use. Below is a detailed explanation of how to achieve this using PowerShell and the PnP PowerShell module. Script Overview The script provided here connects to your SharePoint Online sites, iterates through all site pages, and checks for the presence of Stream web parts. It compiles a list of these pages and exports the information to a CSV file. Key Components of the Script 1. Parameters and Global Collection Initialization $PagesDataCollGlobal = @() 2. Function Definition: CheckWebParts This function connects to a given site, retrieves all site pages, and checks each page for Stream web