Closed hmihaella closed 1 week ago
@hmihaella - Have you just tuned off the ability to share directly via the UI and then run the command?
I have just tested with 2.9.0
, but there might be a delay when turning off via SharePoint and running the cmdlet straight after.
However, if you use Disable-PnPSharingForNonOwnersOfSite
and then run Get-PnPSharingForNonOwnersOfSite
, it will correctly show False
.
The command Get-PnPSharingForNonOwnersOfSite
simply returns the result of the CSOM method Office365Tenant.IsSharingDisabledForNonOwnersOfSite , so if there is an issue, it should be with CSOM itself.
The SharePoint Online Management Shell has a similar command at Get-SPOSite -Identity https://contoso.sharepoint.com -DisableSharingForNonOwnersStatus with this note:
DisableSharingForNonOwnersStatus is not a persisted setting but rather an analysis of the state of the site collection.
That might explain the delay.
Closing this , it’s all CSOM under the hood and the delay looks like server side thingy, nothing we can do to fix .
Reporting an Issue or Missing Feature
The command Get-PnPSharingForNonOwnersOfSite to get the default sharing setting details is giving incorrect output.
As per the article https://pnp.github.io/powershell/cmdlets/Get-PnPSharingForNonOwnersOfSite.html the command should return $false if sharing of the site and items in the site is restricted only to owners. I tested on one of our test sites and it returns $True.
Expected behavior
The value returned to be "False"
Actual behavior
The value returned is "True"
Steps to reproduce behavior
Connected via PowerShell:
Connect-PnPOnline -Url https://m365x30315824.sharepoint.com/sites/Design -Interactive Get-PnPSharingForNonOwnersOfSite
What is the version of the Cmdlet module you are running?
ModuleType Version PreRelease Name PSEdition ExportedCommands
Manifest 2.3.0
Which operating system/environment are you running PnP PowerShell on?