Microsoft Graph groups API $filter Contains (contains) and $expand transitiveMembers not working

Vidyadhar Kurmala 1 Reputation point
2022-03-31T16:17:53+00:00

W.r.t documentation aad-advanced-queries I understand $search and $ expand is not supported.. Based on that I tried to use following options $filter Contains(contains) and $expand which is not working as well.

so I would like to know the workable options to read data from transitiveMembers.

Here are few screenshots that are erroring out.

Tried with both $filter=Contains(displayName,'ariba') with $expand and $filter=contains(displayName,'ariba') with $expand.

$filter and $expand:

188807-image.png

$search and $expand

188835-image.png

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

2 answers

Sort by: Most helpful
  1. Vicky Kumar (Mindtree Consulting PVT LTD) 1,166 Reputation points Microsoft Employee
    2022-04-01T07:06:46.81+00:00

    Hi ,

    Note :
    The $filter operator requires advanced query parameters, which are:
    ConsistencyLevel=eventual header
    $count=true query string

    188987-filter.png
    Doc - https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http#group-properties

    Could you please try by using "Startwith" in place of "Contains" , please see the below API
    URL - https://graph.microsoft.com/beta/groups?filter=startsWith(displayName, 'ariba')&$expand=transitiveMemberOf

    Hope you are expecting the same result.

    1 person found this answer helpful.

  2. Vidyadhar Kurmala 1 Reputation point
    2022-04-01T20:25:22.02+00:00

    Hi!

    Thank you for your reply, however startsWith doesn't fit here.

    displayName doesn't accept contains w.r.t this link https://learn.microsoft.com/en-us/graph/aad-advanced-queries?view=graph-rest-1.0&tabs=http

    189266-image.png

    here is a screenshot with filter contains and count = true.

    https://graph.microsoft.com/v1.0/groups?$filter=contains(displayName,'ariba')&$count=true&$expand=transitiveMembers($select =displayName,onPremisesSamAccountName)&$select=displayName,description

    189319-image.png

    I already tried startsWith, however the requirement is to get the group names that contains Ariba keyword, so the options are either to use contains or search with $expand to get the group information along with transitiveMembers.

    When we go with startsWith, we will miss the records that have Ariba in the middle of group i.e. "Contractor Ariba Users".

    There is a way to fulfill the requirement, however this will definitely degrades the performance.
    Here are the steps to follow:

    1. First call: get all group names that has Ariba keyword using https://graph.microsoft.com/v1.0/groups?$search="displayName:ariba"
    2. Loop through each record and call the second API https://graph.microsoft.com/v1.0/groups/{id}/transitiveMembers

    so let's wait and see if we get any feasible solution on this requirement.

    0 comments No comments