Share via

Graph Mail api - data-attributes are deleted when working with drafts

Alaa elias 1 Reputation point
2022-01-23T13:59:41.217+00:00

I'm working with Graph api to create and manage draft messages on outlook.
I'm generating an HTML body and trying to add data-attributes on an element in the body.
But when I create/update the draft, my attribute is being deleted and the draft message is saved without it.

For example, if I use:
POST https://graph.microsoft.com/v1.0/me/messages (using create message api - https://learn.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http)
with this body:
"body":{
"contentType":"HTML",
"content":"<div data-my-var="value"> This element has a data attribute </div>"
}
My data-my-var attribute is being deleted and the body I get in the response doesn't have it

I'm building my own email editor which is integrated with office and I don't want to lose my special attributes after creating/updating the draft on the mail provider.

Is there any way to make this work or any alternative approach?

Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.