microsoftgraph / microsoftgraph/msgraph-sdk-php
MIME Content returns empty JSON or a 405 status using HTTP GET
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- PHP
- Sterne
- 669
- Forks
- 150
- Ø Merge
- 15 Std. 21 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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.
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
Es werden keine Repository-Dateien oder Tests genannt. Beginne mit den createRequest-Aufrufen und dem Rückgabetyp MimeContent. Vergleiche anschließend beide Nachrichten-URL-Formen im Graph Explorer mit delegierter und Anwendungsautorisierung, einschließlich freigegebener Postfächer. Als abgeschlossen gilt die Ermittlung, ob es sich bei dem Verhalten um einen SDK-Fehler oder eine Einschränkung der API/Authentifizierung handelt, sowie die Dokumentation oder Behebung der bestätigten Ursache.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- api, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100