Exchange Webservice从可用性列表中获取会议ID

时间:2018-07-09 13:36:25

标签: exchangewebservices

我正在创建

之类的约会
dates.join(dates.apply(lambda x: pd.Series(pd.date_range(x.LoadDate, 
x.DischDate, freq='T')).dt.strftime('%m-%y'),1)
     .apply(lambda x: x.value_counts(),1)
     .rename(columns=lambda x: pd.to_datetime(x, format='%m-%y').strftime('%b-%y'))/1440)

然后我可以检索CalIdVal

我的系统列出了用户的约会。我用

Appointment appointment = new Appointment(service);
appointment.Subject = m.Subject;
appointment.Start = m.StartTime;
appointment.End = m.EndTime;
appointment.StartTimeZone = TimeZoneInfo.Utc;
appointment.EndTimeZone = TimeZoneInfo.Utc;
....
appointment.Save(folder, SendInvitationsMode.SendToNone);

我想过滤掉上面创建的约会。 但是此列表不包含任何ID,所以我看不到它。

任何建议表示赞赏

1 个答案:

答案 0 :(得分:0)

您需要将GetUserAvailability中的FreeBusyViewType设置为“详细https://docs.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.freebusyviewtype?view=exchange-ews-api”,然后应返回约会的HexEntryId列表,然后可以将其转换为EWSId,以便可以绑定/过滤例如

        DateTime StartTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 0:00"));
        DateTime EndTime = StartTime.AddDays(1);
        TimeWindow tmTimeWindow = new TimeWindow(StartTime, EndTime);
        AvailabilityOptions aoOptions = new AvailabilityOptions();
        aoOptions.RequestedFreeBusyView = Microsoft.Exchange.WebServices.Data.FreeBusyViewType.DetailedMerged;
        aoOptions.MeetingDuration = 30;
        List<AttendeeInfo> atAttendeeList = new List<AttendeeInfo>();
        atAttendeeList.Add(new AttendeeInfo("user@domain.com"));
        GetUserAvailabilityResults avResponse = service.GetUserAvailability(atAttendeeList, tmTimeWindow, AvailabilityData.FreeBusy, aoOptions);
        Int32 atnCnt = 0;
        foreach (AttendeeAvailability avail in avResponse.AttendeesAvailability)
        {
            Console.WriteLine(atAttendeeList[atnCnt].SmtpAddress);
            Int32 mc = 0;
            var merged = avail.MergedFreeBusyStatus;
            while (StartTime < EndTime)
            {
                Console.WriteLine(StartTime.ToString() + " " + merged[mc]);
                mc++;
                StartTime = StartTime.AddMinutes(30);
            }
            foreach (Microsoft.Exchange.WebServices.Data.CalendarEvent calendarItem in avail.CalendarEvents)
            {
                Console.WriteLine("Free/busy status: " + calendarItem.FreeBusyStatus);
                Console.WriteLine("Start time: " + calendarItem.StartTime);
                Console.WriteLine("End time: " + calendarItem.EndTime);
                var convertedId = (AlternateId)service.ConvertId(new AlternateId(IdFormat.HexEntryId, calendarItem.Details.StoreId, "someemail@domain.com"), IdFormat.EwsId);
                var apt = Appointment.Bind(service, new ItemId(convertedId.UniqueId));
            }
            atnCnt++;
        }