当我使用服务帐户添加新约会时,组织者始终是Credentials to Exchange服务的用户,我想将组织者设置为另一个用户,但组织者属性是readonly,我该如何实现?
var appointment = new Appointment(_service.ExchangeService);
if (exchangeAppointment.Participants.Any() && exchangeAppointment.Participants != null)
{
foreach (var participant in exchangeAppointment.Participants)
{
appointment.RequiredAttendees.Add(participant);
}
}
appointment.Resources.Add(exchangeAppointment.RoomAdIdentityEmail);
appointment.Location = string.Join(",", appointment.Resources);
appointment.Subject = exchangeAppointment.Subject;
appointment.Body = exchangeAppointment.Body;
appointment.Start = exchangeAppointment.StartTime;
appointment.End = exchangeAppointment.EndTime;
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

答案 0 :(得分:3)
主办单位将根据您保存约会的日历进行设置,当您使用服务帐户创建主办单位的约会OnBehalf时,您需要将保存位置设置为您想要的主办单位的日历例如
Save(new FolderId(WellKnownFolderName.Calendar, "user@ddomain.com"), SendInvitationsMode.SendToAllAndSaveCopy);
另一种选择是使用EWS模拟,然后模拟管理器http://msdn.microsoft.com/en-us/library/office/dd633680%28v=exchg.80%29.aspx
干杯 格伦