Comments (14)
Ah I forgot there is another way of doing this (I added support for this a couple of weeks ago for another user):
Try:
CollectionPage<User> page = client.users().memberOf().filter(User.class).get();
I tried this example and it worked for me.
CollectionPage page = client.users().members().filter(User.class).get();
Now, I am able to list sub-groups and users in a group separately.
Thanks a lot for the response and have a good day.
from odata-client.
Client side filtering using streams and select
to reduce data downloaded:
List<User> users = client //
.groups() //
.select("id,groupTypes") //
.stream() //
.filter(g -> {
List<String> types = g.getGroupTypes().toList();
return types.contains("Unified") || types.isEmpty();
}) //
.flatMap(g -> g.getMembers().filter(User.class).stream()) //
.collect(Collectors.toList());
I know this compiles but I haven't tested it live.
from odata-client.
One last thing, we can filter groups with odata-client on the basis of group-type which can be unified or null(i.e- Security and Office 365 group)
In Graph API 1.0 we cannot filter with group-type property.So groupType is a collection itself in a group so you'd need to look for some
contains
operator in a filter. If you want all users in groups of a certain group-type or group-types then I doubt you'd be able to do it in one call (OData does not give you full sql-like join control). Just return the appropriate groups then on each group return the users. Are there so many groups returned that you can't filter client side? If you are concerned with bringing back lots of data in these calls then use.select
and.metadataNone()
.
Thanks for the information.
from odata-client.
A bit more googling would have got you there. There is an isOf
operator you can use in a filter:
GET https://graph.microsoft.com/beta/directoryObjects/delta?$filter=isOf('Microsoft.Graph.User')+or+isOf('Microsoft.Graph.Group')
from odata-client.
Ah I forgot there is another way of doing this (I added support for this a couple of weeks ago for another user):
Try:
CollectionPage<User> page = client.users().memberOf().filter(User.class).get();
from odata-client.
A bit more googling would have got you there. There is an
isOf
operator you can use in a filter:GET https://graph.microsoft.com/beta/directoryObjects/delta?$filter=isOf('Microsoft.Graph.User')+or+isOf('Microsoft.Graph.Group')
I was referring to the documentation for Microsoft Graph API 1.0.
I did not want to use the beta version for Microsoft Graph API.
from odata-client.
What version are you using?
When I try client.users()
there is no .members()
method.
from odata-client.
Ah you mean client.groups().members()
?
from odata-client.
Ah you mean
client.groups().members()
?
Yes.
Ah I forgot there is another way of doing this (I added support for this a couple of weeks ago for another user):
Try:CollectionPage<User> page = client.users().memberOf().filter(User.class).get();I tried this example and it worked for me.
CollectionPage page = client.groups().members().filter(User.class).get();Now, I am able to list sub-groups and users in a group separately.
Thanks a lot for the response and have a good day.
from odata-client.
Ripper, glad you're sorted.
from odata-client.
Ah you mean
client.groups().members()
?
Yes, groups().members().
It was a typo.
from odata-client.
Ah you mean
client.groups().members()
?Yes, groups().members().
It was a typo.
Thanks a lot.
from odata-client.
One last thing, we can filter groups with odata-client on the basis of group-type which can be unified or null(i.e- Security and Office 365 group)
In Graph API 1.0 we cannot filter with group-type property.
from odata-client.
One last thing, we can filter groups with odata-client on the basis of group-type which can be unified or null(i.e- Security and Office 365 group)
In Graph API 1.0 we cannot filter with group-type property.
So groupType is a collection itself in a group so you'd need to look for some contains
operator in a filter. If you want all users in groups of a certain group-type or group-types then I doubt you'd be able to do it in one call (OData does not give you full sql-like join control). Just return the appropriate groups then on each group return the users. Are there so many groups returned that you can't filter client side? If you are concerned with bringing back lots of data in these calls then use .select
and .metadataNone()
.
from odata-client.
Related Issues (20)
- [Documentation] Authentication with OData Service HOT 7
- Cannot deserialize UnsignedByte using Serializer.deserialize HOT 5
- upload file to onedrive through createUploadSession - itemWithPath() not found HOT 4
- httpResponse of odata.client.HttpResponse put(String s, .List<RequestHeader> list, InputStream inputStream, int i,HttpRequestOptions httpRequestOptions) does not give reponse body in httpResponse.getText() as post() method gives. HOT 8
- odata\client\TestingService.class- not returning response body for patchOrPut() method. HOT 17
- post() now does a HTTP PUT HOT 4
- HttpPatch Delta<T> parameter is always Null HOT 1
- odata-client-runtime dependency on jaxb-core and jaxb-impl HOT 2
- Unable to generate a client with dynamics finance and operations metadata HOT 10
- Support "Evolvable Enumerations" with a default value HOT 5
- Hit java reserved identifier 'package' HOT 5
- Automatic mapping of "expanded" objects support? HOT 4
- Requesting an individual resource - request produced using path parameter instead of ID in brackets encoded in URL HOT 2
- How to use @odata.nextLink in graph client sdk to get the next set of messages. HOT 2
- Generated ActionRequest fails with NullPointerException if we provide null for non-required parameters. HOT 4
- odata-client-msgraph: Support for legacy extended properties HOT 33
- $orderBy condition misspelled in query url HOT 2
- Nested types not cast correctly to sub-class when data loaded via "expand" HOT 3
- Functions parameters not mapped to query parameters for GET HOT 3
- Post method write data to CRM but give Exception when building response HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odata-client.