GRAPH, authors of SendMail and CreateMessage require slightly different JSON structures. BugByDesign

GRAPH, authors of SendMail and CreateMessage require slightly different JSON structures. BugByDesign
0

Upvotes

Upvote

 Jun 10 2021
0 Comments 
New

Both SendMail  and CreateMessage should be using this documented JSON Request structure  message resource type - Microsoft Graph v1.0 | Microsoft Docs

 

The MS development team was not consistent with the authoring of the JSON “message” Body used for Send Mail and CreateMessage API. (Bug, by Design)  Using SendMail the JSON Body requires a top\root node named “messages” which is correct as per the documented structure. But, when using CreateMessage the JSON Body structure is EXACTLY the same except that the JSON Body MUST NOT have a root node named “messages’. This took me hours to figure out and resolve. It should be fixed as both API’s deal with creation of email messages and extra code is required when using both functions to manage the JSON Request structures submitted.