microsoftgraph / microsoftgraph/msgraph-sdk-python

Python SDK Returning None for All Non-ID Value Fields

Đang mở
#945 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Attention :wave: priority:p1 type:bug
Ngôn ngữ chính
Python
Star
630
Fork
96
Merge trung bình
15 giờ 20 phút
Pull request đã merge (30 ngày)
3

Mô tả

Describe the bug

In the Graph Explorer API I can run the following get request:

https://graph.microsoft.com/v1.0/me/memberOf?$search="displayName:{display_name}"&$select=displayName,id
Headers: ConsistencyLevel: eventual, Prefer: legacySearch=false

Below is my version in the Python SDK:

request_config = RequestConfiguration(
    options=[ResponseHandlerOption(NativeResponseHandler())]
)
request_config.headers.add("ConsistencyLevel", "eventual")
request_config.headers.add("Prefer", "legacySearch=false")

url = (f'https://graph.microsoft.com/v1.0/me/'
       f'memberOf?$search="displayName:{displayName}"&$select=displayName,id')

groups = await (self
                .user_client
                .me
                .with_url(url)
                .get(request_config))
groups_data = groups.json()
groups_value = groups_data['value']
return groups_value
Expected behavior

In the Graph API Explorer, I get the following result:

  {
      "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects(displayName,id)",
      "value": [
          {
              "@odata.type": "#microsoft.graph.group",
              "displayName": "{display_name}",
              "id": "{group_id}"
          }
      ]
  }

In the Python application, I get the following result:

[{'@odata.type': '#microsoft.graph.group', 'displayName': None, 'id': '{group_id}'}]

So basically, in the Python code, I am only getting the ID field value. All other field values of interest such as displayName are returned as None.

Is there some way to alter this code to make the non-ID field values displayable?

How to reproduce

Running the example code above should be sufficient to reproduce this scenario.

SDK Version

1.11.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

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


### Configuration

_No response_

### Other information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Chạy yêu cầu memberOf được cung cấp bằng Python SDK 1.11.0, bao gồm RequestConfiguration, NativeResponseHandler và lệnh gọi with_url().get, sau đó so sánh JSON của yêu cầu này với kết quả Graph Explorer. Bắt đầu bằng cách truy vết cách trình xử lý phản hồi ánh xạ các trường không phải ID. Hoàn tất khi displayName và các giá trị đã chọn khác được giữ nguyên thay vì được trả về dưới dạng None.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 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
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.