File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,20 @@ function Invoke-EditGroup {
371371 }
372372 }
373373
374+ # Only process visibility if it was explicitly sent for Microsoft 365 groups
375+ if ($GroupType -eq ' Microsoft 365' -and -not [string ]::IsNullOrWhiteSpace($UserObj.visibility )) {
376+ try {
377+ $VisibilityValue = $UserObj.visibility
378+ $null = New-GraphPOSTRequest - uri " https://graph.microsoft.com/beta/groups/$ ( $GroupID ) " - type PATCH - tenantid $TenantId - body (@ {' visibility' = $VisibilityValue } | ConvertTo-Json )
379+
380+ $Results.Add (" Set group visibility to $VisibilityValue for $ ( $GroupName ) ." )
381+ } catch {
382+ $ErrorMessage = Get-CippException - Exception $_
383+ Write-Warning " Error in visibility: $ ( $ErrorMessage.NormalizedError ) - $ ( $_.InvocationInfo.ScriptLineNumber ) "
384+ $Results.Add (" Failed to set group visibility for $ ( $GroupName ) : $ ( $ErrorMessage.NormalizedError ) " )
385+ }
386+ }
387+
374388 # Only process sendCopies if it was explicitly sent
375389 if ($null -ne $UserObj.sendCopies ) {
376390 try {
You can’t perform that action at this time.
0 commit comments