question

AustinWang-7244 avatar image
12 Votes"
AustinWang-7244 asked saldana-msft edited

Microsoft Hybrid Messages Create API Not Working

I'm trying to use MicrosoftGraphAPI to create an email draft, and later send it it. I'm getting stuck making the API call to create the draft. An error is thrown The property 'subject' does not exist on type 'Microsoft.OutlookServices.Message'. Make sure to only use property names that are defined by the type or mark the type as open type. REST APIs for this mailbox are currently in preview. You can find more information about the preview REST APIs at https://dev.outlook.com/.

See below for the full error message.

Note: This is a Microsoft Exchange Hybrid Environment.

Note this part -

Make sure to only use property names that are defined by the type or mark the type as open type.

Seems like there's some sort of configuration that's setting this message property as not open or something. Is there a configuration for that somewhere? I'm not seeing it anywhere.



RESPONSE w/ Error
{
"error": {
"code": "RequestBodyRead",
"message": "The property 'subject' does not exist on type 'Microsoft.OutlookServices.Message'. Make sure to only use property names that are defined by the type or mark the type as open type. REST APIs for this mailbox are currently in preview. You can find more information about the preview REST APIs at https://dev.outlook.com/.",
"innerError": {
"date": "2021-10-14T06:26:10",
"request-id": "5a706591-c6d9-4d3b-8092-af1b696b2655",
"client-request-id": "5a706591-c6d9-4d3b-8092-af1b696b2655"
}
}
}


Request (Exported from postman)
{
"info": {
"_postman_id": "5349b210-3dca-4318-9e5e-a0ef4b06a169",
"name": "Microsoft Graph Client Test",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "https://graph.microsoft.com/v1.0/me/messages",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJ0eXAiO---OMITED",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n subject: \"Hello world\",\n body: {\n contentType: \"html\",\n content: \"Test email\"\n },\n toRecipients: [ {\n emailAddress: {\n address: \"test@test.co\"\n }\n }],\n ccRecipients: [],\n bccRecipients: []\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/me/messages",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"me",
"messages"
]
}
},
"response": []
}
]
}


office-exchange-hybrid-itpromicrosoft-graph-sdkmicrosoft-graph-mail
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers