Microsoft Graph Api {"code":"ErrorInvalidPropertySet","message":"Set action is invalid for property."}

Viewed 574

We use

PATCH https://graph.microsoft.com/v1.0/users/{userId}/{messageId}/ 

to update the just created email draft in order to send it later.

During the call we get 400 error with the next text -> '{"error":{"code":"ErrorInvalidPropertySet","message":"Set action is invalid for property."}}'

We get it only for several mailboxes. What could be the possible reason? Is it related to the mailbox configuration? What should we pay attention to?

2 Answers

If you are trying to update a message use

PATCH /users/{id | userPrincipalName}/messages/{messageid} 

this way. This error mainly occurs when you try to set a read only property. Please check if the payload which you are using is having any property with readonly access. Also go through this document.

The issue was in internetMessageHeaders field. We used this field in our PATCH payload, but it is not presented in PATCH method at all and sometimes Microsoft Graph API returns 400, but sometimes not.(even in case of no error this field is ignored) So if you face this issue - just check whether you send the internetMessageHeaders field in your payload or not.

I guess it could be applied to all other readonly fields.

Related