【问题标题】:Why invitees/details of Windows.ApplicationModel.Appointments.Appointment are empty为什么 Windows.ApplicationModel.Appointments.Appointment 的受邀者/详细信息为空
【发布时间】:2015-01-28 07:09:24
【问题描述】:

我正在开发一个 Windows Phone 8.1 应用程序,该应用程序想要从日历中获取会议。 我正在使用 Windows 运行时 api 来获得这样的所有约会:

AppointmentStore appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);

IReadOnlyList<Windows.ApplicationModel.Appointments.Appointment> appointments = await appointmentStore.FindAppointmentsAsync(DateTime.Now, TimeSpan.FromHours(24)); ;
        foreach (var appointment in appointments)
        {
            var persistentId = appointment.RoamingId;
            var details = appointment.Details;//the details is empty, why
            var invitees = appointment.Invitees;//the invitees is also empty, why?
        }

实际上,我尝试了Microsoft Phone api,我可以获取详细信息和参加者(被邀请者)。但是,Microsoft Phone api 无法获取约会 ID。谁能告诉我如何获得约会ID和详细信息/受邀者?谢谢!

Appointments appts = new Appointments();

            //Identify the method that runs after the asynchronous search completes.
            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Calendar_SearchCompleted);

            DateTime start = DateTime.Now;
            DateTime end = start.AddDays(1);
            int max = 100;
            appts.SearchAsync(start, end, max, "test");

private async void Calendar_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
    {
        foreach (Microsoft.Phone.UserData.Appointment appt in e.Results)
        {
            var details = appt.Details;//I can get the details

            var participants = new ObservableCollection<Person>();
            var attendees = appt.Attendees;
            if (attendees != null)
            {
                foreach (var attende in attendees)
                {
                    Person attendPerson = new Person()
                    {
                        Email = attende.EmailAddress,
                        FullName = attende.DisplayName,
                        PersonID = attende.EmailAddress
                    };

                    participants.Add(attendPerson);
                }

            }



            ....
        }
    }

【问题讨论】:

    标签: c# windows-phone-8.1 appointment


    【解决方案1】:

    您需要添加 FindAppointmentsOptions 以获得您想要的任何详细信息,请尝试以下代码

     AppointmentStore appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);
    
            FindAppointmentsOptions options = new FindAppointmentsOptions();
            options.MaxCount = 100;
            options.FetchProperties.Add(AppointmentProperties.Subject);
            options.FetchProperties.Add(AppointmentProperties.Location);
            options.FetchProperties.Add(AppointmentProperties.Invitees);
            options.FetchProperties.Add(AppointmentProperties.Details);
            options.FetchProperties.Add(AppointmentProperties.StartTime);
            options.FetchProperties.Add(AppointmentProperties.ReplyTime);
            IReadOnlyList<Windows.ApplicationModel.Appointments.Appointment> appointments = await appointmentStore.FindAppointmentsAsync(DateTime.Now, TimeSpan.FromHours(24), options);
            foreach (var appointment in appointments)
            {
                var persistentId = appointment.RoamingId;
                var details = appointment.Details;//the details is empty, why
                var invitees = appointment.Invitees;//the invitees is also empty, why?
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-09
      • 1970-01-01
      • 1970-01-01
      • 2018-12-12
      • 2013-07-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多