microsoftgraph / microsoftgraph/msgraph-sdk-php

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

Abierto
#1,210 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
PHP
Estrellas
669
Forks
150
Merge medio
15 h 21 min
PR fusionados (30 d)
3

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se nombran archivos ni pruebas del repositorio. Empieza con las llamadas a createRequest y el tipo de retorno MimeContent; después, compara ambas formas de URL de mensaje en Graph Explorer usando autorización delegada y de aplicación, incluidos los buzones compartidos. Se considera terminado cuando se determine si el comportamiento es un defecto del SDK o una limitación de la API/autenticación, y se documente o aborde la causa confirmada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
api, backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.