Graph API list joined Teams where isArchived =false

300 views Asked by At

I am following information from C# teams and while this works fine I would like to only download data whereby the property 'isArchived' = false. Is it possible to add a filter to do this?

I could loop through the collection after I have downloaded the data and eliminate based on this value but it seems like an extra step to perform and there are a lot of teams to loop through.

var joinedTeams = await graphClient.Me.JoinedTeams
.Request()
.GetAsync();
2

There are 2 answers

1
Ehssan On BEST ANSWER

Use the Filter(...) method on the request object:

var joinedTeams = await graphClient.Me.JoinedTeams
    .Request()
    .Filter("isArchived eq false")
    .GetAsync();
0
Ergec On

Since I'm using mostly HTTP requests , not sure about the exact syntax, especially in the filter value, but it should be very similar to this one. You may need to play the "isArchive eq False" section a bit.

var queryOptions = new List<QueryOption>()
{
    new QueryOption("$filters", "isArchive eq False")
};

var joinedTeams = await graphClient.Me.JoinedTeams
    .Request( queryOptions )
    .Filter("isArchive eq False")
    .GetAsync();