![](/img/trans.png)
[英]Exchange services to get list of attendees of a meeting (microsoft outlook) in C#
[英]Using exchange web services to get the required attendees of a calendaritem? c#
我正在嘗試獲得使用交換Web服務的會議所需的與會者。 有任何想法嗎? 我想我需要使用CalendarItemType,但我不確定如何實現它。 到目前為止,這是我的代碼:
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?
}
}
}
工人是我用類名單和相應的電子郵件地址列出的類。
您可以使用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);
}
}
您可能必須在調用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.