Api 将新事件添加到office365日历
我想使用Office 365 API将新事件添加到自定义日历(名为“calendar XY”)。我不知道为什么,但所有事件都会添加到默认日历(名为“日历”)中Api 将新事件添加到office365日历,api,office365,Api,Office365,我想使用Office 365 API将新事件添加到自定义日历(名为“calendar XY”)。我不知道为什么,但所有事件都会添加到默认日历(名为“日历”)中 \u client.Me.Calendars[myCalendar.Id].Events.AddEventAsync(newEvent) 当使用Fiddler检查时,我注意到,即使@odata.context是正确的(Id为“Calendar XY”),@odata.editLink仍然指向默认日历Id 这里是完整的背景,但我看不出有什么
\u client.Me.Calendars[myCalendar.Id].Events.AddEventAsync(newEvent)代码>
当使用Fiddler检查时,我注意到,即使@odata.context
是正确的(Id为“Calendar XY”),@odata.editLink
仍然指向默认日历Id
这里是完整的背景,但我看不出有什么有趣的地方:
const string ExchangeResourceId = "https://outlook.office365.com";
const string ExchangeServiceRoot = "https://outlook.office365.com/ews/odata";
var _authenticator = new Authenticator();
var authInfo = await _authenticator.AuthenticateAsync(ExchangeResourceId);
var _client = new ExchangeClient(new Uri(ExchangeServiceRoot), authInfo.GetAccessToken);
var myCalendar = await (
from calendar in _client.Me.Calendars
where calendar.Name == "Calendar XY"
select calendar
)
.ExecuteSingleAsync();
var newEvent = new Event
{
Start = dayData.DateTimeFrom,
End = dayData.DateTimeTo,
Location = new Location { DisplayName = dayData.Location },
Subject = dayData.Subject,
Importance = Importance.Low,
ResponseRequested = false,
ShowAs = FreeBusyStatus.Free,
};
await _client.Me.Calendars[myCalendar.Id].Events.AddEventAsync(newEvent);
首先,感谢您使用新的Office 365 API!深入研究之后,这似乎是服务层的一个bug。我提出了一个跟踪问题。我们需要深入研究这一点,并在我们这方面做一些代码更改。我们将解决这个问题,但是我没有关于何时在服务中修复的预计到达时间。谢谢你的反馈
大卫·洛斯
高级项目经理-Exchange您只需显示一行代码,是否可以显示添加活动的完整代码?请查看我的原始帖子(我添加了更深入的内容)嗨,David,谢谢您的反馈。你能通知我,事情办完了吗?