如何使用Office 365 API向电子邮件添加类别?

时间:2014-08-11 02:08:41

标签: api office365 office365-apps

我正在尝试使用Office 365 Preview API客户端库向电子邮件中添加类别。

使用下面的代码我能够成功更新邮件的主题,但是会默默地忽略添加类别

IMessage message = ... // get messages from Inbox as in Office 365 stock sample

message.Subject = "updated subject";
message.Categories.Add("green");
await message.UpdateAsync();

查看生成的http请求,json正文确实包含类别更新,但似乎没有效果。我在这里做错了什么?

PATCH https://outlook.office365.com/EWS/OData/Me/Messages('AQMkADBmODQzNWQ2LWIyODktNDU5Ny1iYzVmLTJmOWVjOGQyYjllOABGAAADVp5Ppgti7E2YFHUl1UZ8-gcAl76n1kdoS0i38bpnpX9naAAAAw4AAACXvqfWR2hLSLfxumelf2doAAAATx9HqgAAAA==') HTTP/1.1
OData-Version: 4.0;NetFx
OData-MaxVersion: 4.0;NetFx
Content-Type: application/json;odata.metadata=minimal
If-Match: W/"CQAAABYAAACXvqfWR2hLSLfxumelf2doAAFJSlEM"
Accept: application/json;odata.metadata=minimal
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer eyJ0eXAiOi......
X-ClientService-ClientTag: Office 365 API Tools, 1.1.0512
Host: outlook.office365.com
Content-Length: 178
Expect: 100-continue

{"@odata.type":"#Microsoft.Exchange.Services.OData.Model.Message","Categories@odata.type":"#Collection(String)","Categories":["green"],"Subject":"updated subject"}

0 个答案:

没有答案