uwp约会ID总是一样的

时间:2017-12-11 14:26:18

标签: c# uwp

我正在尝试向Outlook日历添加约会。但是在我成功添加约会后,我得到的约会ID总是与" HxS _"相同。 我在Package.appxmanifest文件中添加了约会功能。 这是我的代码:

var appointment = new Windows.ApplicationModel.Appointments.Appointment();
// StartTime
var date = DateTime.Now.Date;
var time = DateTime.Now.TimeOfDay;
var timeZoneOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now);
var startTime = new DateTimeOffset(date.Year, date.Month, date.Day, time.Hours, time.Minutes, 0, timeZoneOffset);
appointment.StartTime = startTime;

//Subject
appointment.Subject ="Subject";

// Location
appointment.Location ="Location";

// Details
appointment.Details = "Details";

//Duration
appointment.Duration = TimeSpan.FromMinutes(30);

// AllDay
appointment.AllDay = true;

//Reminder
appointment.Reminder = TimeSpan.FromMinutes(15);


//BusyStatus
appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.Busy;

// Sensitivity
appointment.Sensitivity = Windows.ApplicationModel.Appointments.AppointmentSensitivity.Public;

//uri
appointment.Uri = new System.Uri("http://bing.com");

var rect =new Rect();

String appointmentId = await Windows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync(
                       appointment,rect, Windows.UI.Popups.Placement.Default);
await new MessageDialog(appointmentId).ShowAsync();

每次约会时间为" HxS _",这意味着我无法在我的应用中使用appointmentId替换或删除约会。 谁能解决我的问题?

0 个答案:

没有答案