microsoftgraph / microsoftgraph/msgraph-sdk-python

BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error

Aperta
#1,015 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Describe the bug

Here is my code :

batch_requests = BatchRequestContent()
for message_id in message_ids:
  query_params = MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
      select=[
        'id',
        'conversationId',
        'internetMessageId',
        'subject',
        'body',
        'bodyPreview',
        'from',
        'toRecipients',
        'ccRecipients',
        'bccRecipients',
        'receivedDateTime',
        'sentDateTime',
        'internetMessageHeaders',
        'isRead',
        'isDraft',
        'importance',
        'hasAttachments',
        'categories',
      ]
    )
    request_configuration = RequestConfiguration(
      query_parameters=query_params
    )
    request = service.me.messages.by_message_id(message_id).to_get_request_information(
      request_configuration=request_configuration
    )
    request_id = str(uuid.uuid4())
    batch_request_item = BatchRequestItem(id=request_id, request_information=request)
    #   batch_request_item.url = batch_request_item.url.replace('https://graph.microsoft.com/v1.0', '')
    batch_requests.add_request(request_id=request_id, request=batch_request_item)

Without the line I've commented, it causes a 400 "Resource not found for the segment 'https:'".
I figured out the problem by looking at your code.

I guess it is not the behavior as you intended.

Expected behavior

The server answer a code HTTP 200

How to reproduce

1 - List message ids from Outlook
2 - Try to get the email content in batch

SDK Version

No response

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

Inizia tracciando BatchRequestItem e BatchRequestContent.add_request usando l’esempio Python, quindi esamina come viene costruito l’URL della richiesta per le operazioni batch. Verifica il comportamento con la riproduzione del batch di messaggi Outlook e conferma che l’elemento inviato utilizzi un percorso relativo e riceva HTTP 200 senza la soluzione alternativa.

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
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.