[BUG] Get-PnPTenantSite returns incorrect property values when retrieving all sites
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 904
- Forks
- 407
- Avg merge
- 9h 16m
- Merged PRs (30d)
- 10
Description
Describe the bug
Get-PnPTenantSite can return different values for OverrideTenantAnonymousLinkExpirationPolicy depending on whether a single site or all tenant sites are queried.
The issue occurs with and without -Detailed.
There may also be other properties affected by the same issue, although I have not yet tested all properties.
To Reproduce
$siteUrl = "https://<tenant>.sharepoint.com/sites/<siteurl>"
$singleSite = Get-PnPTenantSite `
-Identity $siteUrl `
-Connection $ConAdmin
$allSites = Get-PnPTenantSite `
-Connection $ConAdmin
$filteredSite = $allSites |
Where-Object { $_.Url -eq $siteUrl }
$singleSite.OverrideTenantAnonymousLinkExpirationPolicy
$filteredSite.OverrideTenantAnonymousLinkExpirationPolicy
Result:
True
False
The same behavior occurs when using:
Get-PnPTenantSite -Detailed
for the $allSites query.
The site is the same in both cases.
Expected behavior
The same site should return the same property values regardless of whether it is queried individually or as part of the tenant-wide result.
If a property is not available when retrieving all sites, I would expect it to be $null rather than returning an incorrect/default value such as False.
Actual behavior
The individual query returns:
OverrideTenantAnonymousLinkExpirationPolicy = True
while the tenant-wide query returns:
OverrideTenantAnonymousLinkExpirationPolicy = False
This makes the property unreliable for tenant-wide auditing and raises the possibility that other SPOSite properties may be affected as well.
Environment
- PnP.PowerShell:
3.4.1 - SharePoint Online
- Windows PowerShell
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Get-PnPTenantSite cmdlet implementation and trace the separate single-site and tenant-wide retrieval paths, including how OverrideTenantAnonymousLinkExpirationPolicy is populated. Reproduce the example against SharePoint Online, then add or update regression coverage for both query modes. Done means the same site's property value is preserved, or unavailable values are returned as $null rather than a default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100