Below you will find pages that utilize the taxonomy term “PnP”
posts
Adding M365 Group/Teams Owners and Members to SharePoint Group with PnP PowerShell
Introduction There are situations where you might want to reuse the M365 Group principals to assign permissions to other sites without creating additional Entra ID groups. This can be useful for:
Adding M365 group members to a SharePoint site, such as an intranet site for ‘Human Resources’ managed by the ‘Human Resources’ M365 Group/Teams or a hub site managed by a ‘Service Desk’ M365 Group/Teams. Adding M365 group members to custom or out-of-the-box SharePoint groups, such as adding particular M365 group owners or members to custom groups created for additional libraries within a different site.
posts
Automate Renewal of Expiring M365 Groups Using PowerShell
Introduction Managing the lifecycle of Microsoft 365 Groups is important to prevent accidental deletion of M365 Groups. It is a good practice to set lifecycle expiration policy to control sprawl. However that means that the group will get automatically deleted after they expire. The Teams/M365 groups owners will get email notifications to renew within a certain timeframe , however if the owners missed the renewal notifications for different reasons, it may lead to accidental data loss.
posts
PowerShell: Fetch Files with Retention or Sensitivity Labels in SharePoint Online
Introduction Understanding the sensitivity and retention labels applied to files in your SharePoint Online sites is essential for maintaining data security and compliance. These labels enable you to manage and protect your data by defining retention periods and handling sensitive information appropriately. This is particularly important for initiatives like the Microsoft 365 Copilot rollout, ensuring that the correct files are stored within the appropriate SharePoint sites. For example, if a SharePoint site is a public Team site, files labeled as confidential should be moved to a private Team site or existing Team site updated from public to private.
posts
PnP Powershell GetPnPflow using asAdmin parameter
As part of the multi tenant app registration for PnP PowerShell deprecated on the 9th September 2024, we need to have our own app registration and grant the required permissions. Read more from Changes in PnP Management Shell registration in Microsoft 365
For the cmdlet Get-PnPFlow it requires permissions Azure: management.azure.com which is Azure Service Management
Simply adding the permission as it does not require admin consent and executing the cmdlet below yields no results
posts
Enhanced Version Controls/Intelligent Versioning Trim with PowerShell
Microsoft has introduced Enhanced Version Controls, previously known as Intelligent Versioning, as part of its public preview in May 2024. This feature, detailed in the Microsoft 365 Roadmap 145802, aims to help administrators manage file versions more effectively, reducing storage costs by removing unnecessary versions.
Extract from the Roadmap
We are introducing new version controls that help tenant and site admins or document library owners reduce the storage footprint driven by low value file versions.
posts
Oversight of Sharing Information in SharePoint sites using PowerShell with CSOM, REST and PnP PowerShell
Effective oversight of sharing links and sharing information are paramount to ensuring data security, compliance, and optimal collaboration experiences.
As organisations migrate to M365 environments, they inherit powerful collaboration tools that facilitate seamless sharing of documents and resources. However, without proper governance, these capabilities can lead to unintended consequences such as data breaches, compliance violations, and loss of intellectual property.
Sharing is a powerful feature for collaboration. However depending on how items, files or folders are shared, a sharing link might be created or unique permissions on these items are created.
posts
Overcoming SharePoint's List View Threshold with CAML Queries in PowerShell
Overcoming SharePoint’s List View Threshold with CAML Queries in PowerShell Encountering the list view threshold error in SharePoint when dealing with lists exceeding 5,000 items is a common challenge. Using CAML queries within PowerShell scripts offers a server-side solution to efficiently filter and retrieve data, yet is prone to the list view threshold error.
Sample script This is the sample PowerShell script querying the specified SharePoint list using CAML query.
posts
Find orphaned choice values in SharePoint list/libraries using PowerShell
Find orphaned choice values in SharePoint list/libraries using PowerShell One common issue is orphaned choice values in SharePoint lists which may affect subsequent update to the list item. This can occur when list items contain values that are no longer valid according to the list’s choice field values. This post covers a PowerShell script to identify these orphaned choice values in SharePoint lists to either update them or add them back to the list of choice field values.
posts
Working with psm1 Files in PowerShell
Working with PowerShell Script Module Files:psm1 Have you ever utilized a psm1 file to create reusable functions across multiple ps1 files? If so, you might have encountered the frustration of edits not reflecting immediately due to module caching.
I recently faced this issue when updating a psm1 file; despite making changes, the updates didn’t take effect immediately. The issue stemmed from module caching.
The only solution I found to load the updated psm1 file was to terminate the PowerShell session and start a new one.
posts
Get Folder Item properties using PnP PowerShell : Get-PnPFolderItem versus Get-PnPListItem
Get Folder Item properties using PnP PowerShell : Get-PnPFolderItem versus Get-PnPListItem Introduction In this blog post, we will explore an alternative approach to retrieving folder item properties using PnP PowerShell. We will discuss the limitations of the Get-PnPFolderItem cmdlet and demonstrate how to use Get-PnPListItem to overcome those limitations.
The Limitations of Get-PnPFolderItem The Get-PnPFolderItem cmdlet is not suitable for working with large libraries. When attempting to retrieve items from a large library, you may encounter the following error message:
posts
Custom document library template using PnP PowerShell
Custom document library template using PnP PowerShell Creating custom list templates is now possible to create both custom document libraries and lists.
This article explores the option how to use a combination of list design and PowerShell script to provision multiple instances of document libraries using a CSV file and how to create a document library from a custom list template from UI.
First we can create a list design for our library based on an existing configured document library with custom content types, fields and views.
posts
Automating Site Reindexing with PowerShell
Automating Site Reindexing with PowerShell Introduction Keeping your SharePoint environment up-to-date is crucial, especially after making schema changes. One important aspect of maintaining accurate and relevant search results is to regularly reindex sites, libraries, or lists. In this blog post, we will explore a streamlined approach using PnP PowerShell to automate the reindexing process. By leveraging this script, you can ensure that your search results reflect the latest changes in your SharePoint environment.
posts
PowerShell: Set and Remove SharePoint Site Thumbnail Logo
For many organizations, maintaining a consistent brand identity across SharePoint sites is crucial. The distinction between “Site Logo” and “Site Logo Thumbnail” is essential, as they serve different purposes across SharePoint and the Microsoft 365 ecosystem. The site logo appears in the site header, while the site logo thumbnail is used in search results, site cards, when copying/moving files, and other critical areas. It plays a vital role in helping end users differentiate between various SharePoint Online (SPO) sites and Teams.
posts
Unveiling Audit Logs with PnP and Cli for M365 PowerShell
Unveiling Audit Logs with PnP PowerShell for the last 7 days Understanding and tracking activities within your M365 environment is crucial for maintaining security and compliance. Audit Logs offer a wealth of information, and in this post, we’ll delve into the methods to retrieve and analyze them. Specifically, we’ll focus on leveraging the Office 365 Management Activity API reference through the Get-PnPUnifiedAuditLog PnP PowerShell cmdlet. It is a great alternative if you are only a SharePoint Administrator with no global admin or Purview Audit logs access.
posts
A Guide to Contributing to PnP PowerShell
A Guide to Contributing to PnP PowerShell Contributing to PnP PowerShell is a rewarding journey. Whether you’re a seasoned contributor or a beginner, this guide aims to simplify the process and keep it handy for your next contribution.
Prerequisites To set up the development to start hacking on PnP PowerShell, install the following
Install Git Install PowerShell 7 Install Visual Code or Visual Studio Code Install .NET SDK 6 (https://dotnet.microsoft.com/download/dotnet/6.0) Forking and cloning First things first, make a copy of the repository to start working on your changes.
posts
Discovering All Checked Out Files including those with no checked in versions with PnP PowerShell
Discovering All Checked Out Files including those with no checked in versions There are scenarios when files uploaded won’t have “checked-in version” which will make the files visible only to their uploader. Two possible scenarios that can lead to the situation:
Mandatory Metadata Requirements: When there are mandatory fields configured on the libraries and end users use Onedrive as a medium to upload the files to SharePoint via a shortcut to OneDrive.
posts
Copy Column View Formatting to different environment using PnP PowerShell
Copy Column and View Formatting using PnP PowerShell There is a great sample script how to backup all column, view and content type formatting by Dan Toft. If you need to copy column and view formatting across different environments, such as from Dev to Test, UAT, and Prod, especially when dealing with multiple lists/libraries, the script may help you.
PnP PowerShell Script param ( [Parameter(Mandatory=$false)] [string]$SourceSiteUrl = "https://contoso.sharepoint.com/teams/d-app-test", [Parameter(Mandatory=$false)] [string]$DestinationSiteUrl = "https://contoso.