Skip to content

Add missing HasHolds property to Get-PnPTenantSite cmdlet output#4976

Merged
gautamdsheth merged 4 commits intodevfrom
copilot/fix-4973
Jun 23, 2025
Merged

Add missing HasHolds property to Get-PnPTenantSite cmdlet output#4976
gautamdsheth merged 4 commits intodevfrom
copilot/fix-4973

Conversation

Copy link
Contributor

Copilot AI commented Jun 23, 2025

Issue

The HasHolds property was missing from Get-PnPTenantSite cmdlet output in PnP.PowerShell 3.1.0, although it was available in the legacy SharePointPnPPowerShellOnline module. This property indicates whether a site has litigation holds applied, which is important for compliance and governance scenarios.

Root Cause

The underlying Microsoft.Online.SharePoint.TenantAdministration.SiteProperties class contains the HasHolds property, but it wasn't being mapped to the SPOSite model class used by the Get-PnPTenantSite cmdlet.

Changes Made

  1. Added HasHolds property to SPOSite model (src/Commands/Model/SPOSite.cs):

    • Added public bool HasHolds { get; set; } property declaration
    • Added property mapping HasHolds = props.HasHolds; in the constructor
  2. Added unit test to verify the property exists and has the correct type

  3. Fixed unrelated build error in ListItemHelper.cs to ensure builds succeed

Impact

Users can now access the HasHolds property when using:

  • Get-PnPTenantSite -Identity <SiteUrl>
  • Get-PnPTenantSite -Identity <SiteUrl> -Detailed

The output will include:

HasHolds : True

(or False, depending on whether the site has litigation holds applied)

Verification

  • ✅ Build succeeds without errors
  • ✅ Property correctly mapped from SiteProperties to SPOSite
  • ✅ Unit test validates implementation
  • ✅ No breaking changes - purely additive functionality

This restores functionality that users expected from the legacy SharePointPnPPowerShellOnline module.

Fixes #4973.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits June 23, 2025 18:29
Co-authored-by: gautamdsheth <8832018+gautamdsheth@users.noreply.github.com>
Co-authored-by: gautamdsheth <8832018+gautamdsheth@users.noreply.github.com>
…entation

Co-authored-by: gautamdsheth <8832018+gautamdsheth@users.noreply.github.com>
Copilot AI changed the title [WIP] Property HasHolds missing when retrieving Site with Get-PnPTenantSite Add missing HasHolds property to Get-PnPTenantSite cmdlet output Jun 23, 2025
Copilot AI requested a review from gautamdsheth June 23, 2025 18:37
@gautamdsheth gautamdsheth marked this pull request as ready for review June 23, 2025 18:42
@gautamdsheth gautamdsheth merged commit 5b37318 into dev Jun 23, 2025
5 checks passed
@gautamdsheth gautamdsheth deleted the copilot/fix-4973 branch July 5, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Property HasHolds missing when retrieving Site with Get-PnPTenantSite

2 participants