Skip to content

Commit 5b37318

Browse files
Add missing HasHolds property to Get-PnPTenantSite cmdlet output (#4976)
* Initial plan * Initial investigation: Found HasHolds property in SiteProperties Co-authored-by: gautamdsheth <[email protected]> * Add HasHolds property to SPOSite model for Get-PnPTenantSite cmdlet Co-authored-by: gautamdsheth <[email protected]> * Clean up duplicate test methods and finalize HasHolds property implementation Co-authored-by: gautamdsheth <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: gautamdsheth <[email protected]>
1 parent b97375b commit 5b37318

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/Commands/Model/SPOSite.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public class SPOSite
9090
public bool IsGroupOwnerSiteAdmin { get; set; }
9191
public bool ListsShowHeaderAndNavigation { get; set; }
9292
public int LockReason { get; set; }
93+
public bool HasHolds { get; set; }
9394
public int MajorVersionLimit { get; set; }
9495
public int MajorWithMinorVersionsLimit { get; set; }
9596
public bool RestrictedAccessControl { get; set; }
@@ -186,6 +187,7 @@ public SPOSite(SiteProperties props, bool? disableSharingForNonOwnersStatus)
186187
IsGroupOwnerSiteAdmin = props.IsGroupOwnerSiteAdmin;
187188
ListsShowHeaderAndNavigation = props.ListsShowHeaderAndNavigation;
188189
LockReason = props.LockReason;
190+
HasHolds = props.HasHolds;
189191
MajorVersionLimit = props.MajorVersionLimit;
190192
MajorWithMinorVersionsLimit = props.MajorWithMinorVersionsLimit;
191193
RestrictedAccessControl = props.RestrictedAccessControl;

src/Commands/Utilities/ListItemHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public static Dictionary<string, object> GetFieldValues(PnP.Core.Model.SharePoin
571571
if (choices is string)
572572
{
573573
// Handle comma or semicolon separated string
574-
itemValue = string.Join(";#", ((string)choices).Split([',', ';'], StringSplitOptions.RemoveEmptyEntries).Select(c => c.Trim()));
574+
itemValue = string.Join(";#", ((string)choices).Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(c => c.Trim()));
575575
}
576576
else if (choices is Array)
577577
{

src/Tests/Admin/GetPnPTenantSiteTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ public void GetPnPTenantSiteTest()
8989
Assert.IsNotNull(results);
9090
}
9191
}
92+
93+
[TestMethod]
94+
public void SPOSiteModelHasHoldsPropertyTest()
95+
{
96+
// Test that the SPOSite model has the HasHolds property
97+
var spoSiteType = typeof(PnP.PowerShell.Commands.Model.SPOSite);
98+
var hasHoldsProperty = spoSiteType.GetProperty("HasHolds");
99+
100+
Assert.IsNotNull(hasHoldsProperty, "HasHolds property should exist on SPOSite model");
101+
Assert.AreEqual(typeof(bool), hasHoldsProperty.PropertyType, "HasHolds property should be of type bool");
102+
}
92103
#endregion
93104
}
94105
}

0 commit comments

Comments
 (0)