为什么 invitees/details of Windows.ApplicationModel.Appointments.Appointment 是空的

Why invitees/details of Windows.ApplicationModel.Appointments.Appointment are empty

我正在开发一个 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?
        }

其实我试过微软的Phoneapi,我可以得到详细信息和与会者(invitees)。但是,Microsoft Phone api 无法获取约会 ID。谁能告诉我如何获得预约 ID 和 details/invitees?谢谢!

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

            }



            ....
        }
    }

您需要添加 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?
        }