Get list of all public groups using graph api

Kumar, Ratnesh 21 Reputation points
2021-07-27T17:14:18.417+00:00

Hello,

I need a direct query to graph api to get list of all public groups present in O365.

I am trying using below query but its giving 400 Bad request as I cannot use visibility property with $filter.

https://graph.microsoft.com/v1.0/groups?&$filter=groupTypes/any(a:a eq 'unified')&visibility eq 'Public'

Please let me know if we have a direct way to get list of all public group

Regards,
Ratnesh

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

1 answer

Sort by: Most helpful
  1. Vasil Michev 106.1K Reputation points MVP
    2021-07-27T17:43:23.137+00:00

    The visibility property is not supported for $filter, you can get the full list and then filter it client-side. And for the sake of completeness, this is not how you combine multiple filters, use the 'and' operator:

    https://graph.microsoft.com/beta/groups?&$filter=groupTypes/any(a:a eq 'unified') and visibility eq 'Public'
    

    (still wont work in this case).

    1 person found this answer helpful.
    0 comments No comments

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.