Skip to content

Commit

Permalink
Merge pull request #3865 from pkernevez/fix-issue-with-team-owner
Browse files Browse the repository at this point in the history
Fix issue 3759
  • Loading branch information
NikCharlebois authored Nov 8, 2023
2 parents dad7013 + a862621 commit f918f21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* O365OrgSettings
* Force register the Office on the Web ServicePrincipal is it is not present.
FIXES [#3842](https://github.com/microsoft/Microsoft365DSC/issues/3842)
* TeamsTeam
* Fixes incomplete import due to error "Cannot index into a null array"
FIXES: [#3759](https://github.com/microsoft/Microsoft365DSC/issues/3759)

# 1.23.1101.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,17 @@ function Get-TargetResource

Write-Verbose -Message "Getting Team {$DisplayName} Owners"
[array]$Owners = Get-TeamUser -GroupId $team.GroupId | Where-Object { $_.Role -eq 'owner' }
if ($null -eq $Owners) { # Without Users, Get-TeamUser return null instead on empty array
$Owners = @()
}

Write-Verbose -Message "Found Team $($team.DisplayName)."

$result = @{
DisplayName = $team.DisplayName
GroupID = $team.GroupId
Description = $team.Description
Owner = $Owners[0].User.ToString()
Owner = [array]$Owners.User
MailNickName = $team.MailNickName
Visibility = $team.Visibility
AllowAddRemoveApps = $team.AllowAddRemoveApps
Expand Down

0 comments on commit f918f21

Please sign in to comment.