我尝试使用以下方法为日历活动添加附件:
POST /groups/{id}/calendar/events/{id}/attachments
{
"@odata.type": "#microsoft.graph.fileAttachment",
"name": "menu.txt",
"contentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
在v1.0 verison中我得到:
Failure - Status Code 403
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "...",
"date": "2018-03-27T06:50:03"
}
}
}
但是我已经设置了所有权限。
在测试版中我得到:
Failure - Status Code 400
{
"error": {
"code": "NavigationNotSupported",
"message": "Recursive navigation is not allowed after property 'Events' according to the entity schema.",
"innerError": {
"request-id": "...",
"date": "2018-03-27T06:59:44"
}
}
}
这只是终点不起作用还是我做错了什么?
答案 0 :(得分:0)
使用下面的C#代码:
var thisEventFetcher = outlookServicesClient.Me.Calendar.Events.GetById(eventID);
Attachment attachment = new FileAttachment{
Name = "test",
ContentBytes = File.ReadAllBytes(@"D:\test.jpeg"),
ContentType = "image/jpeg"
};
await thisEventFetcher.Attachments.AddAttachmentAsync(attachment);