在日历启动Uri方案中添加“约会”

时间:2017-01-21 09:22:53

标签: c# uwp win-universal-app windows-10-universal uri-scheme

您可以使用Uri Schemes启动其他应用来管理请求,例如拨打电话:

await Launcher.LaunchUriAsync(new Uri("tel: " + number));

我需要使用日历Uri方案在UWP App中为日历(日,小时和标题)添加约会,但我不知道哪个是日历的标准Uri方案(如果存在)。

另一种选择是使用“Outlookcal”来启动Outlook(而不是使用标准uri方案),但我无法找到syntaxis来添加日期,小时和标题的约会,我只知道如何启动Outlook日历:< / p>

await Launcher.LaunchUriAsync(new Uri("outlookcal:"));

任何人都知道如何使用日历Uri方案添加约会,或使用Outlookcal Uri方案添加约会?

1 个答案:

答案 0 :(得分:1)

您不必使用URI方案(它似乎没有在任何地方记录)。可以创建约会directly using the UWP API

//create appointment
var appointment = new Windows.ApplicationModel.Appointments.Appointment();

// ... set its properties
appointment.StartTime = DateTime.Now + TimeSpan.FromDays(1);
appointment.Subject = "Meeting subject";
appointment.Details = "Meeting description";

//show popup to add to calendar
string appointmentId = 
   await Windows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync(
                         appointment, 
                         rect, 
                         Windows.UI.Popups.Placement.Default );