Last active
August 29, 2015 14:15
-
-
Save Gr8Gatsby/a70e81d3cf7e1760d400 to your computer and use it in GitHub Desktop.
Windows.ApplicationModel.Appointments JavaScript example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(Windows && Windows.ApplicationModel && Windows.ApplicationModel.Appointments) {} | |
// Create an Appointment that should be added the user's appointments provider app. | |
var appointment = new Windows.ApplicationModel.Appointments.Appointment(); | |
// Get the selection rect of the button pressed to add this appointment | |
var boundingRect = e.srcElement.getBoundingClientRect(); | |
var selectionRect = { x: boundingRect.left, y: boundingRect.top, width: boundingRect.width, height: boundingRect.height }; | |
// ShowAddAppointmentAsync returns an appointment id if the appointment given was added to the user's calendar. | |
// This value should be stored in app data and roamed so that the appointment can be replaced or removed in the future. | |
// An empty string return value indicates that the user canceled the operation before the appointment was added. | |
Windows.ApplicationModel.Appointments.AppointmentManager.showAddAppointmentAsync(appointment, selectionRect, Windows.UI.Popups.Placement.default) | |
.done(function (appointmentId) { | |
if (appointmentId) { | |
console.log("Appointment Id: " + appointmentId); | |
} else { | |
console.log("Appointment not added"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment