microsoftgraph / microsoftgraph/msgraph-sdk-python
Python SDK Returning None for All Non-ID Value Fields
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 630
- Forks
- 96
- Ø Merge
- 15 Std. 20 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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_
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe die bereitgestellte memberOf-Anfrage mit Python SDK 1.11.0 aus, einschließlich RequestConfiguration, NativeResponseHandler und des Aufrufs with_url().get, und vergleiche deren JSON mit dem Ergebnis von Graph Explorer. Beginne damit nachzuverfolgen, wie der Response-Handler Felder abbildet, die keine IDs sind. Erledigt ist es, wenn displayName und andere ausgewählte Werte erhalten bleiben, statt als None zurückgegeben zu werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100