msgraph-sdk-java
msgraph-sdk-java copied to clipboard
Fetching allMembers fails for public and private channels
Describe the bug
According to the documentation the allMembers endpoint can be used for any channel type. This can be confirmed using the Graph Explorer or manualy invoking that endpoint.
However, when using the SDK to fetch all members for any channel that is not shared the request fails.
com.microsoft.graph.models.odataerrors.ODataError: Failed to execute GetThreadRosterAsync.
at com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:212)
at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:706)
at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26)
at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:705)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:307)
at com.microsoft.graph.teams.item.channels.item.allmembers.AllMembersRequestBuilder.get(AllMembersRequestBuilder.java:102)
at com.microsoft.graph.teams.item.channels.item.allmembers.AllMembersRequestBuilder.get(AllMembersRequestBuilder.java:88)
...
Expected behavior
The request should work for any channel type (as it does when using the members() endpoint insted of allMembers().
How to reproduce
graphClient.teams()
.byTeamId(team.getId())
.channels()
.byChannelId(channel.getId()) //use a private or public channel here
.allMembers()
.get(); //the error occurs at this point unless the provided channel has MembershipType.Shared
SDK Version
6.45.0
Latest version known to work for scenario above?
No response
Known Workarounds
Check the Channel.getMembershipType() and fallback to members() if the channel is not shared
Debug output
No response
Configuration
No response
Other information
No response