question

SayyedBabarAli-3405 avatar image
0 Votes"
SayyedBabarAli-3405 asked SayyedBabarAli-3405 commented

Setting the Category of an Email through an HTTPS PATCH request

I want to send a PATCH request to set the "categories" collection of an email to a value say "XYZ". What's wrong with the following HTTP request in Microsoft Graph Explorer and how can it be corrected?

PATCH

 https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$Id=&"correctidofemail"&$top=1

Request Body:

{"categories": ["XYZ"]}

Generally, the question is how to set the categories of emails in Outlook from an HTTP PATCH request as described above. Is it possible at all? Are there any examples?

azure-information-protectionazure-ad-microsoft-accountazure-queue-storage
· 1
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.

Ok, I see one problem is the OData queries like $top=1 are not supported by PATCH and only supported by GET.

The question still remains, can we set the category of an email in Outlook using a PATCH request at all? If so, how?

0 Votes 0 ·

1 Answer

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered SayyedBabarAli-3405 commented

Hello @SayyedBabarAli-3405


You can use below patch call to set category of a given message:


Call: PATCH https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/your_message_id


Body: {"categories":["your_category_name"]}


Refer to the screenshot below:


9925-untitled.png




Please do not forget to "Accept the answer" wherever the information provided helps you. This will help others in the community as well.



untitled.png (38.9 KiB)
· 1
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.

Thanks! That works!

0 Votes 0 ·