microsoftgraph / microsoftgraph/msgraph-sdk-java

`channels().post()` returns `null` when creating a shared channel (`membershipType: shared`)

オープン
#2,555 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

status:waiting-for-triage type:bug
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
4

説明

Describe the bug

When creating a channel with membershipType set to ChannelMembershipType.Shared, the graphClient.teams().byTeamId(teamId).channels().post(channel) method returns null instead of a Channel object.
This works correctly for standard and private channel types, which return the expected Channel object.

Root cause analysis

According to the Microsoft Graph API documentation (Example 5 — Create a shared channel), creating a shared channel returns an HTTP 202 Accepted with a Location header pointing to a teamsAsyncOperation, whereas standard/private channels return a 201 Created with the Channel object in the response body.

The SDK's .post() method appears to only handle the 201 Created case, deserializing the response body into a Channel object. When it receives a 202 Accepted (with no Channel in the body), it returns null without providing access to the response headers or the async operation.

This is the same issue reported in the .NET SDK: microsoftgraph/msgraph-sdk-dotnet#1728

Expected behavior

One of the following:

  • Preferred: The SDK should detect the 202 Accepted response, follow the Location header, poll the teamsAsyncOperation until completion, and return the resulting Channel object — providing a consistent developer experience across all channel types.

  • Alternative: The SDK should return a wrapper type (e.g., ChannelPostResponse) that can represent either a Channel (for 201) or a TeamsAsyncOperation (for 202), along with the Location/Content-Location headers.

  • Minimum: The documentation should clearly state that .post() returns null for shared channels, and provide a documented pattern to retrieve the channel using NativeResponseHandler (or equivalent in Java).

How to reproduce
ChannelMembershipType type = ChannelMembershipType.Shared;

Channel channel = new Channel();
channel.setOdataType("#Microsoft.Graph.channel");
channel.setMembershipType(type);
channel.setDisplayName("My Shared Channel");
channel.setDescription("Test shared channel creation");

LinkedList<ConversationMember> members = new LinkedList<>();
AadUserConversationMember conversationMember = new AadUserConversationMember();
conversationMember.setRoles(List.of("owner"));
HashMap<String, Object> additionalData = new HashMap<>();
additionalData.put("user@odata.bind",
    "https://graph.microsoft.com/v1.0/users('" + ownerId + "')");
conversationMember.setAdditionalData(additionalData);
members.add(conversationMember);
channel.setMembers(members);

// This returns null for shared channels, but works for standard/private
Channel result = graphClient.teams().byTeamId(teamId).channels().post(channel);

System.out.println(result); // null
SDK Version

6.62.0

Latest version known to work for scenario above?

6.62.0

Known Workarounds

None

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、graphClient.teams().byTeamId(teamId).channels().post(channel) で共有チャネルのケースを再現し、その 202 応答を標準チャネルおよびプライベートチャネルの 201 応答と比較します。Microsoft Graph の共有チャネル作成に関するドキュメントを読み、SDK の応答処理を確認します。非同期応答に対する合意済みの動作が定義されていること、または API を変更しない場合に明確な処理方法が文書化されていることが完了条件です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。