Graph SDK - Get Group config in address book

Stygre 20 Reputation points
2023-07-14T10:10:21.7766667+00:00

Hi,
I'm looking to inventory all my O365 groups using PS graph SKD.
I'm using something like :

Get-MgGroup -All -Property Id,DisplayName,GroupTypes,ResourceProvisioningOptions,CreatedDateTime,Mail,Description,Owners,MailEnabled,Visibility | Where-Object {$_.groupTypes -like "*Unified*"} 

But I'm not able to get is group is published in Address Book.

I'm finding no property like "Hide from GAL : <Yes/No>"
Any hints around how to get this last info ?

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,998 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 113.3K Reputation points MVP
    2023-07-14T16:03:33.39+00:00

    The property you need is hideFromAddressLists. It is only returned when you specifically request it via the $select statement, and only when querying individual groups (i.e. /groups/{groupId}), and not the generic LIST endpoint the above cmdlet is using.

    As a workaround, this should do:

    Get-MgGroup -Filter "groupTypes/any(x:x eq 'Unified')" -All -Property Id, DisplayName, GroupTypes, ResourceProvisioningOptions, CreatedDateTime, Mail, Description, Owners, MailEnabled, Visibility | select Id, DisplayName, GroupTypes, ResourceProvisioningOptions, CreatedDateTime, Mail, Description, Owners, MailEnabled, Visibility, @{n="hideFromAddressLists";e={(Get-MgGroup -GroupId $_.Id -Property hideFromAddressLists).hideFromAddressLists}}
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.