microsoftgraph / microsoftgraph/msgraph-beta-sdk-java
User::getProfile retrieves null when it shouldn't
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 32
- 派生
- 14
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 6
描述
Describe the bug
I'm trying to get all users in a group and after that getting the users profile.
While this won't work:
- getting Users as transitiveMembers of a group
UserCollectionResponse userResult = graphClient.groups() .byGroupId(groupId) .transitiveMembers() .graphUser() .get(); - iterate over all users
userResult.getValue().forEach(this::getProfile); - call User::getProfile but it returns always null even when profile is existing and permissions are granted.
private void getProfile(User user) { Profile profile = user.getProfile(); }
It will work when you do this instead of user.getProfile() in step 3:
private void getProfile(User user) { Profile profile = graphClient.users().byUserId(user.getId()).profile().get(); }
This returns the profile for me.
Expected behavior
when calling User::getProfile i expect to get the profile back instead of null.
How to reproduce
- getting Users as transitiveMembers of a group
UserCollectionResponse userResult = graphClient.groups() .byGroupId(groupId) .transitiveMembers() .graphUser() .get(); - iterate over all users
userResult.getValue().forEach(this::getProfile); - call User::getProfile but it returns always null even when profile is existing and permissions are granted.
private void getProfile(User user) { Profile profile = user.getProfile(); }
SDK Version
6.47.0
Latest version known to work for scenario above?
No response
Known Workarounds
Use:
graphClient.users().byUserId(user.getId()).profile().get();
instead of User::getProfile
Debug output
Configuration
No response
Other information
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先重现 transitiveMembers() 流程,并检查该链返回的用户的 User::getProfile()。将其与 graphClient.users().byUserId(user.getId()).profile().get() 进行比较;当直接访问 User profile 在报告的场景中返回现有 profile 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100