Skip to content

Commit 11de9ef

Browse files
committed
fix: addtogroup functionality
1 parent 426427c commit 11de9ef

File tree

1 file changed

+3
-4
lines changed
  • Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users

1 file changed

+3
-4
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,14 @@ Function Invoke-EditUser {
140140
if ($AddToGroups) {
141141
$AddToGroups | ForEach-Object {
142142

143-
$GroupType = $_.value.groupType -join ','
144-
$GroupID = $_.value.groupid
145-
$GroupName = $_.value.groupName
143+
$GroupType = $_.addedFields.calculatedGroupType
144+
$GroupID = $_.value
145+
$GroupName = $_.label
146146
Write-Host "About to add $($UserObj.userPrincipalName) to $GroupName. Group ID is: $GroupID and type is: $GroupType"
147147

148148
try {
149149

150150
if ($GroupType -eq 'Distribution list' -or $GroupType -eq 'Mail-Enabled Security') {
151-
152151
Write-Host 'Adding to group via Add-DistributionGroupMember '
153152
$Params = @{ Identity = $GroupID; Member = $UserObj.id; BypassSecurityGroupManagerCheck = $true }
154153
$null = New-ExoRequest -tenantid $UserObj.tenantFilter -cmdlet 'Add-DistributionGroupMember' -cmdParams $params -UseSystemMailbox $true

0 commit comments

Comments
 (0)