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
2. Function Definition CheckWebParts
This function connects to a given site, retrieves all site pages, and checks each page for Stream web parts.
3. Main Script Logic
The script connects to the root site, retrieves all subsites, and calls the CheckWebParts function for each site and its subsites recursively.
Running the Script
- Install the PnP PowerShell Module: If you haven't already, install the PnP PowerShell module.
- Connect to Your SharePoint Online Site: Update the $SiteURL variable with your SharePoint site URL.
- Execute the Script: Run the script in a PowerShell window. Ensure you have the necessary permissions to access the SharePoint sites.
- Review the Output: The script will generate a CSV file at the specified path ($CSVFile), listing all pages with and without Stream web parts.
Conclusion
This script provides a systematic approach to identify Stream web parts across your SharePoint pages, helping you prepare for the transition to the new Stream. By exporting the results to a CSV file, you can easily review and manage the impacted pages.
Regards,
Keyur Pandya
Connect with me on LinkedIn