简体   繁体   English

使用交换Web服务获取日历项目所需的参与者? C#

[英]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.

相关问题 交换服务以获取C#中的会议参加者列表(Microsoft Outlook) - Exchange services to get list of attendees of a meeting (microsoft outlook) in C# 使用Exchange Web Services从C#中的自定义和已发送邮件文件夹获取电子邮件 - Get emails from custom and sent mail folders in c# using Exchange Web Services 如何使用 C# 和 Exchange Web Services Managed API 获取文件夹的策略? - How to get a folder's policy using C# and Exchange Web Services Managed API? 是否可以使用c#中的Exchange Web服务分配角色? - Is it possible to assign roles using the Exchange web services in c#? 如何使用Exchange Web Services在C#中更改电子邮件主题 - How to change email subject in C# using Exchange Web Services 使用Exchange Web服务在c#中获取特定日期的电子邮件 - Fetching emails for a specific date in c# using Exchange Web Services 如何使用C#以编程方式仅向所需参加者之一发送交流约会邀请? - How does one send an exchange appointment invite to only one of the required attendees programmatically with C#? Exchange Web服务 - 创建资源约会,但与会者无法查看资源 - Exchange Web Services - Create appointment with resource but attendees cannot see resource Exchange Web服务和C#:如何从共享日历中获取约会 - Exchange Web Services and C#: How to get appointments from shared calendar 使用C#中的Exchange Web服务托管API检索错误的邮箱项目 - Wrong mailbox items being retrieved using Exchange Web Services managed API in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM