使用Exchange Web服务,以获得一个calendaritem的要求与会者? C# [英] Using exchange web services to get the required attendees of a calendaritem? c#

查看:487
本文介绍了使用Exchange Web服务,以获得一个calendaritem的要求与会者? C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我得到了使用Exchange Web服务的会议所需的与会者。有任何想法吗?我想我需要使用CalendarItemType,但我不知道如何实现它。
这是我到目前为止的代码:

I am trying to get the required attendees of a meeting which I got using the exchange web service. Any ideas? I think I need to use CalendarItemType, but I'm not sure how to implement it. 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.

推荐答案

您可以通过结合使用预约<一个检索所需与会者HREF =http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.appointment.bind%28v=EXCHG.80%29.aspx相对=nofollow> Appointment.Bind

You can retrieve the required attendees by binding to the appointment using 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);
    }
}

您可能要转换 CalendarEvent.Details.StoreId 为不同的格式之前调用 Appointment.Bind (我不知道这个),所以如果上面的代码是不是工作你可以尝试添加一个调用的 ExchangeService.ConvertId

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:

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);
    }
}

这篇关于使用Exchange Web服务,以获得一个calendaritem的要求与会者? C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆