Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExchangeFunctions
- {
- private const string _username = "uname";
- private const string _password = "password";
- private const string _domain = "domain";
- public static string CreateAppointment(string mailboxId, MyAppointment appt)
- {
- var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
- service.Credentials = new WebCredentials(_username, _password, _domain);
- // auto loads the url for the targetted mailbox
- service.AutodiscoverUrl(mailboxId);
- var appointment = ConvertAppointment(service, appt);
- // save the appointment, bound to the targetted user's mailbox, using delegate permissions
- appointment.Save(new FolderId(WellKnownFolderName.Calendar, mailboxId));
- }
- // Convert My Appointment to Exchange Appointment class
- private Appointment ConvertAppointment(ExchangeService service, MyAppointment appt)
- {
- // create the appointment
- var appointment = new Appointment(service);
- appointment.Subject = appt.Subject;
- appointment.Body = appt.Body;
- appointment.Start = appt.Begin;
- appointment.End = appt.End;
- appointment.LegacyFreeBusyStatus = appt.Busy ? LegacyFreeBusyStatus.Busy : LegacyFreeBusyStatus.Free;
- return appointment;
- }
- }
Add Comment
Please, Sign In to add comment