Skip to content

Commit 62290be

Browse files
authored
Merge pull request #66 from ppolkadots/main
Adding updates to handle serialization error
2 parents e82a54a + 4955cb1 commit 62290be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Update-MsIdInvitedUserSponsorsFromInvitedBy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ function Update-MsIdInvitedUserSponsorsFromInvitedBy {
8080

8181
$invitedBy = Invoke-MgGraphRequest @splatArgumentsGetInvitedBy
8282

83-
Write-Verbose ($invitedBy | ConvertTo-Json)
83+
Write-Verbose ($invitedBy | ConvertTo-Json -Depth 10)
8484

8585
if ($null -ne $invitedBy -and $null -ne $invitedBy.value -and $null -ne (Get-ObjectPropertyValue $invitedBy.value -Property 'id')) {
8686
Write-Verbose ("InvitedBy for Guest User {0}: {1}" -f $InvitedUser.DisplayName, $invitedBy.value.id)
8787

88-
if ($InvitedUser.Sponsors.id -notcontains $invitedBy.value.id) {
88+
if (($null -like $InvitedUser.Sponsors) -or ($InvitedUser.Sponsors.id -notcontains $invitedBy.value.id)) {
8989
Write-Verbose ("Sponsors does not contain the user who invited them!")
9090

9191
if ($PSCmdlet.ShouldProcess(("{0} - {1}" -f $InvitedUser.displayName, $InvitedUser.id), "Update Sponsors")) {

0 commit comments

Comments
 (0)