microsoftgraph / microsoftgraph/msgraph-sdk-python
Python SDK Returning None for All Non-ID Value Fields
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 630
- 分支
- 96
- 平均合併
- 15 小時 20 分鐘
- 30 天內合併 PR
- 3
描述
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_
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 Python SDK 1.11.0 執行提供的 memberOf 請求,包括 RequestConfiguration、NativeResponseHandler 和 with_url().get 呼叫,然後將其 JSON 與 Graph Explorer 結果進行比較。先追蹤回應處理常式如何對映非 ID 欄位。完成的標準是 displayName 和其他選取的值能夠保留,而不是以 None 傳回。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100