microsoftgraph / microsoftgraph/msgraph-beta-sdk-java
User::getProfile retrieves null when it shouldn't
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 32
- Fork
- 14
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 6
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện luồng transitiveMembers() và kiểm tra User::getProfile() đối với các user được chuỗi đó trả về. So sánh với graphClient.users().byUserId(user.getId()).profile().get(); được coi là hoàn tất khi việc truy cập trực tiếp vào profile của User trả về profile hiện có trong kịch bản được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100