【发布时间】: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