我使用EWS托管API来加载特定房间资源的约会,并通过WCF发布它,供平板设备使用。
我想取消会议室预订,如果组织者在15分钟后没有执行特定的行动,会议将开始。
由于tablet设备只有用于标识事件的StoreId属性,所以我实现了以下代码:
public bool CancelMeeting(string appointmentId, string roomEmail)
{
try
{
var service = GetExchangeService();
var ai = new AlternateId[1];
ai[0] = new AlternateId();
ai[0].UniqueId = appointmentId;
ai[0].Format = IdFormat.HexEntryId;
ai[0].Mailbox = roomEmail;
ServiceResponseCollection<ConvertIdResponse> cvtresp = service.ConvertIds(ai, IdFormat.EwsId);
var appointment = Appointment.Bind(service, ((AlternateId)cvtresp[0].ConvertedId).UniqueId);
if (appointment.Resources.Count != 0)
appointment.Resources.RemoveAt(0);
appointment.Location = string.Empty;
appointment.Save(SendInvitationsMode.SendOnlyToAll);
return true;
}
catch (Exception ex)
{
return false;
}
}
然而,
if (appointment.Resources.Count != 0)
appointment.Resources.RemoveAt(0);
在此代码中,appointment.Resources.Count始终为0。根据这篇文章(Can't Retrieve Resources (rooms) from Exchange Web Services),您需要告诉EWS具体包括参考资料。如何指定在使用Appointment.Bind时包含资源?
发布于 2015-01-26 15:44:50
就像你联系的那篇文章一样。使用AppointmentSchema.Resources属性创建属性集,并将其传递给绑定方法。
PropertySet includeResources = new PropertySet(BasePropertySet.FirstClassProperties, AppointmentSchema.Resources);
var appointment = Appointment.Bind(service, ((AlternateId)cvtresp[0].ConvertedId).UniqueId, includeResources);
更新:
看上去你在看房间的日历,而不是组织者。在房间的日历里你就看不到资源了。资源仅在组织者的日历中可见。这是因为它们是作为BCC收件人实现的。此外,请记住,从房间的约会副本中移除某些东西不会从其他任何人的邮箱中删除,所以这可能不是最好的方法。相反,您可能想要拒绝会议,这将向组织者发送拒绝通知,并将会议从会议室日历中删除。
https://stackoverflow.com/questions/28112296
复制相似问题