[英]Using exchange web services to get the required attendees of a calendaritem? c#
I am trying to get the required attendees of a meeting which I got using the exchange web service. 我正在尝试获得使用交换Web服务的会议所需的与会者。 Any ideas?
有任何想法吗? I think I need to use CalendarItemType, but I'm not sure how to implement it.
我想我需要使用CalendarItemType,但我不确定如何实现它。 Here is my code so far:
到目前为止,这是我的代码:
foreach (var wrk in Workers)
{
TimeWindow timeWindow = new TimeWindow(startDate, endDate);
AvailabilityData requestedData = AvailabilityData.FreeBusy;
List<AttendeeInfo> attendees = new List<AttendeeInfo>();
attendees.Add(new AttendeeInfo(wrk.EmailAddress));
GetUserAvailabilityResults ares = service.GetUserAvailability(attendees, timeWindow, requestedData);
foreach (AttendeeAvailability av in ares.AttendeesAvailability)
{
foreach (CalendarEvent ev in av.CalendarEvents)
{
//get info from each calendarevent
//Possibly use CalendarItemType here?
}
}
}
Where Workers is a class I made with a list of names and corresponding email addresses. 工人是我用类名单和相应的电子邮件地址列出的类。
You can retrieve the required attendees by binding to the appointment using Appointment.Bind
: 您可以使用
Appointment.Bind
绑定到约会来检索所需的与会者:
foreach (CalendarEvent ev in av.CalendarEvents)
{
var appointment = Appointment.Bind(service, new ItemId(ev.Details.StoreId));
foreach (var requiredAttendee in appointment.RequiredAttendees)
{
Console.WriteLine(requiredAttendee.Address);
}
}
You may have to convert CalendarEvent.Details.StoreId
to a different format before calling Appointment.Bind
(I am not sure about this), so if the above code is not working you may try adding a call to ExchangeService.ConvertId
: 您可能必须在调用
Appointment.Bind
(我不确定这一点)之前将CalendarEvent.Details.StoreId
转换为其他格式,因此如果上述代码不起作用,您可以尝试添加对ExchangeService.ConvertId
的调用:
foreach (CalendarEvent ev in av.CalendarEvents)
{
var convertedId = (AlternateId) service.ConvertId(new AlternateId(IdFormat.HexEntryId, ev.Details.StoreId, "someemail@domain.com"), IdFormat.EwsId);
var appointment = Appointment.Bind(service, new ItemId(convertedId.UniqueId));
foreach (var requiredAttendee in appointment.RequiredAttendees)
{
Console.WriteLine(requiredAttendee.Address);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.