microsoftgraph / microsoftgraph/msgraph-sdk-php

MIME Content returns empty JSON or a 405 status using HTTP GET

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

Nessuno ha ancora preso questa issue.

Lingua principale
PHP
Stelle
669
Fork
150
Merge medio
15h 21m
PR unite (30g)
3

Descrizione

Following the documentation, there are two ways suggested to acccess the content of a message via the Id:

1) GET /users/{id | userPrincipalName}/messages/{id}
2) GET /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}

Within the PHP SDK, I can obtain details of the message with the given Id perfectly fine, however, when adding /$value to obtain the MIME contents, the 1st URL returns an empty JSON where as the second URL returns a 405 Status with a custom message of The OData request is not supported.

Code to reproduce (405 Status - Also, replacing inbox with the Id of the mailFolder also returns 405):

return $graphSdk->createRequest('GET', sprintf('/users/%s/mailFolders/inbox/messages/%s/$value', 'example@example.com', 'MESSAGE-ID-HERE'))
    ->setReturnType(MimeContent::class)
    ->execute();

Code to reproduce (empty JSON):

return $graphSdk->createRequest('GET', sprintf('/users/%s/messages/%s/$value', 'example@example.com', 'MESSAGE-ID-HERE'))
    ->setReturnType(MimeContent::class)
    ->execute();

Removing $value and changing the return type to Message yeilds the intended Message instance as expected. The documentation does not give any guidence on this issue and seems like an API issue as appose to an SDK issue. This can also be reproduced on the Graph Explorer when using the Authorisation header.

Edit: When using delgate flow (oAuth 2.0) the signed in mailbox works fine with the above examples, when using application flow, I am presented with the above issues - this is not suggested in the documentation only by a hint in example 4 that potentially this only works against the "signed in users mailbox". In delegate flow, it doesn't however work if you're acting on behalf of a shared mailbox that the authenticated user has permission to access.

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

Non sono indicati file o test del repository. Inizia dalle chiamate createRequest e dal tipo restituito MimeContent, quindi confronta entrambe le forme di URL dei messaggi in Graph Explorer usando l’autorizzazione delegata e quella applicativa, incluse le cassette postali condivise. Il lavoro è completo quando si determina se il comportamento è un difetto dell’SDK o una limitazione dell’API/autenticazione e si documenta o si risolve la causa confermata.

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

Valutazione

Stack tecnologico
php
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.