microsoftgraph / microsoftgraph/msgraph-sdk-python

Python SDK Returning None for All Non-ID Value Fields

Aperta
#945 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs: Attention :wave: priority:p1 type:bug
Lingua principale
Python
Stelle
630
Fork
96
Merge medio
15h 20m
PR unite (30g)
3

Descrizione

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_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esegui la richiesta memberOf fornita con Python SDK 1.11.0, includendo RequestConfiguration, NativeResponseHandler e la chiamata with_url().get, quindi confronta il relativo JSON con il risultato di Graph Explorer. Inizia tracciando il modo in cui il gestore delle risposte mappa i campi che non sono ID. Il lavoro è completato quando displayName e gli altri valori selezionati vengono preservati invece di essere restituiti come None.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.