0

I am playing around with the msgraph api and i am able to send messages etc but i want to be able to check the status for newly created message. When sending a new message there is not much returned, actually the body is blank and the following status code and headers

Success - Status Code 202
client-request-id: 067e8a6e-ca66-450c-bef3-55b61f72a6bb
content-type: text/plain
cache-control: private
request-id: 067e8a6e-ca66-450c-bef3-55b61f72a6bb

is there a api call where you can get info on status of request ? as the request-id is not part of the send message header or push notification.

Also is there an API call which lets me get all email addresses a user is authorized to send on behave to avoid these kind of responses

{
    "error": {
        "code": "ErrorSendAsDenied",
        "message": "The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message.",
        "innerError": {
            "request-id": "50c4d68b-f23b-4f1f-8202-e95220e45628",
            "date": "2019-02-21T21:43:57"
        }
    }
}
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
MisterniceGuy
  • 1,646
  • 2
  • 18
  • 41

1 Answers1

0

Unfortunately this api does not return a Location header with a link to a status resource for you to monitor. However, you can determine if a mail has been sent successfully by polling the "Sent Items" folder for the email you sent.

GET https://graph.microsoft.com/v1.0/me/mailfolders/{sent-folder-id}/messages?$filter("subject eq '<sent email subject>'")

You can determine the `sent-folder-id' from the response to this:

 GET https://graph.microsoft.com/v1.0/me/mailfolders
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
  • I figured but I thought I ask. Any luck with getting a list from the api what users the user has send on behave off to prevent the errorsendasdenied ? – MisterniceGuy Feb 22 '19 at 06:12