Assigning a contact or contacts to an appointment can be done either through the Contacts dialog box at runtime or programmatically. For information on how to add items, see Add Contacts to the Contacts List.
The contact appears next in the Contacts text box as shown in the following image.
To assign a contact to an appointment at run time, follow these steps:
To assign contacts to an appointment programmatically, use the following code:
C# |
Copy Code
|
---|---|
//Create Appointments Appointment app = new Appointment(DateTime.Now.Date,DateTime.Now.Date.AddDays(1)); app.Subject = "Meeting"; sched1.DataStorage.AppointmentStorage.Appointments.Add(app); //Add contacts to the ContactList sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Lionel Messi" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Cristiano Ronaldo" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Xavi" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Andres Iniesta" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Zlatan Ibrahimovic" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Radamel Falcao" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Robin van Persie" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Andrea Pirlo" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "aya Toure" }); sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Edinson Cavani" }); var appointment = sched1.DataStorage.AppointmentStorage.Appointments.First(x => x.Start == DateTime.Now.Date); var contactList = sched1.DataStorage.ContactStorage.Contacts; appointment.Links.Add(contactList.First(x => x.MenuCaption == "Cristiano Ronaldo")); appointment.Links.Add(contactList.First(x => x.MenuCaption == "Lionel Messi")); |