Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPOSharingSettings: Multiple sites returned from Get-PnPTenantSite #2759

Closed
bjoernf73 opened this issue Jan 9, 2023 · 1 comment · Fixed by #4328 or #4330
Closed

SPOSharingSettings: Multiple sites returned from Get-PnPTenantSite #2759

bjoernf73 opened this issue Jan 9, 2023 · 1 comment · Fixed by #4328 or #4330
Assignees
Labels
Bug Something isn't working SharePoint Online V1.23.111.1 Version 1.23.111.1

Comments

@bjoernf73
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

In MSFT_SPOShareingSettings.psm1, the function Get-TargetResource, from line 162:

$SPOSharingSettings = Get-PnPTenant -ErrorAction Stop
$MySite = Get-PnPTenantSite | Where-Object { $_.Url -match '-my.sharepoint.com/' }

        if ($null -ne $MySite)
        {
            $MySiteSharingCapability = (Get-PnPTenantSite -Identity $MySite.Url).SharingCapability
            #====> Here an exception is thrown, since $MySite in an array....
        }

Get-PnPTenantSite may very well return multiple sites that are redirectors (using .Template = 'RedirectSite#0'), while only one site is the actual MySite (not using .Template = 'RedirectSite#0')

Verbose logs showing the problem

Suggested solution to the issue

Change the line

$MySite = Get-PnPTenantSite | Where-Object { $_.Url -match '-my.sharepoint.com/' }

to

$MySite = Get-PnPTenantSite | Where-Object { $_.Url -match '-my.sharepoint.com/' -and $_.Template -notmatch '^RedirectSite#' }

The DSC configuration that is used to reproduce the issue (as detailed as possible)

(only exporting)

The operating system the target node is running

OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US, nb-NO}

Version of the DSC module that was used ('dev' if using current dev branch)

Dev

@andikrueger andikrueger added Bug Something isn't working SharePoint Online V1.23.111.1 Version 1.23.111.1 labels Jan 16, 2023
@andikrueger andikrueger self-assigned this Feb 14, 2024
@andikrueger
Copy link
Collaborator

This was already partially fixed with #2760. There was one instance left, which will be fixed with my next PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working SharePoint Online V1.23.111.1 Version 1.23.111.1
Projects
None yet
2 participants