2014-06-12 29 views
0

要访问的日历约会中的Windows Phone 8 我使用下面的代码。此代码将检索所有的约会:我如何访问特定的日历约会中的WindowsPhone

private void ButtonAppointments_Click(object sender, RoutedEventArgs e) 
{ 
    Appointments appts = new Appointments(); 

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

    DateTime start = DateTime.Now; 
    DateTime end = start.AddDays(7); 
    int max = 20; 

    //Start the asynchronous search. 
    appts.SearchAsync(start, end, max, "Appointments Test #1"); 
} 

但我想获取并显示特定的日历。 例如,我在我的Outlook帐户中有三个日历:迈克日历,工作日历,生日日历。我只想在我的应用程序中显示迈克的日历约会

在默认日历中,我们可以轻松隐藏或显示特定日历,但我们如何在自己的应用程序中做类似的事情?

回答

0

有Windows运行时API来获取不同的日历。

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

 
      var appCalendars = await appointmentStore.FindAppointmentCalendarsAsync(); 
 
      foreach (var calendar in appCalendars) 
 
      { 
 
      }

的appCalendars是你想要的。