def run(): dataDir = "Data/" #ExStart: WriteMultipleEventsToICS saveOptions = IcsSaveOptions() saveOptions.action = AppointmentAction.CREATE writer = CalendarWriter(dataDir + "WriteMultipleEventsToICS_out.ics", saveOptions) attendees = MailAddressCollection() attendees.append("*****@*****.**") for i in range(10): app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), "*****@*****.**", attendees) app.description = "Test body " + str(i) app.summary = "Test summary:" + str(i) writer.write(app)
def run(): #ExStart: SendingMeetingRequestsViaEmail eml = ae.MailMessage() eml.from_address = "*****@*****.**" eml.to.append(ae.MailAddress("*****@*****.**", "Recipient 1")) #Create Appointment instance app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), eml.from_address, eml.to) app.summary = "Release Meetting" app.description = "Discuss for the next release" eml.add_alternate_view(app.request_apointment()) #Send using Smtp Client client = SmtpClient("smtp.gmail.com", 995, "username", "password") client.security_options = SecurityOptions.AUTO client.send(eml)
def run(): dataDir = "Data/" #ExStart: LoadAppointment #Load Appointment instance loadedAppointment = Appointment.load(dataDir + "AppointmentInICSFormat_out.ics") print("Summary: " + loadedAppointment.summary) print("Location: " + loadedAppointment.location) print("Description: " + loadedAppointment.description) print("Start date: " + str(loadedAppointment.start_date)) print("End date: " + str(loadedAppointment.end_date)) print("Organizer: " + loadedAppointment.organizer.address) print("Attendees: " + loadedAppointment.attendees[0].address)
def run(): #ExStart: SetParticipantStatusOfAppointmentAttendees location = "Room 5" startDate = dt.datetime(2011, 12, 10, 10, 12, 11) endDate = dt.date(2012, 11, 13) organizer = ae.MailAddress("*****@*****.**", "Organizer") attendees = ae.MailAddressCollection() attendee1 = ae.MailAddress("*****@*****.**", "First attendee") attendee2 = ae.MailAddress("*****@*****.**", "Second attendee") attendee1.participation_status = ae.ParticipationStatus.ACCEPTED attendee2.participation_status = ae.ParticipationStatus.DECLINED attendees.append(attendee1) attendees.append(attendee2) target2 = Appointment(location, startDate, endDate, organizer, attendees)
def run(): dataDir = "Data/" #ExStart: CreateAppointment #Create Appointment instance attendees = MailAddressCollection() attendees.append("*****@*****.**") app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), "*****@*****.**", attendees) app.summary = "Release Meetting" app.description = "Discuss for the next release" app.save(dataDir + "AppointmentInICSFormat_out.ics", AppointmentSaveFormat.ICS)
def run(): dataDir = "Data/" #ExStart: GetAttachmentsFromCalendar # Create the appointment attendees = MailAddressCollection() attendees.append("*****@*****.**") app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), "*****@*****.**", attendees) app.summary = "Release Meetting"; app.description = "Discuss for the next release" app.attachments.append(Attachment("1.jpg")) app.attachments.append(Attachment("1.doc")) app.save(dataDir + "appWithAttachments_out.ics", AppointmentSaveFormat.ICS) #Read the attachments from CIS app2 = Appointment.load(dataDir + "appWithAttachments_out.ics") print("Total attachments: " + str(len(app2.attachments))) for att in app2.attachments: print(att.name)
def run(): dataDir = "Data/" #ExStart: DraftAppointmentRequest #Create Appointment instance attendees = MailAddressCollection() attendees.append("*****@*****.**") app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), "*****@*****.**", attendees); app.summary = "Release Meetting"; app.description = "Discuss for the next release" app.method_type = AppointmentMethodType.PUBLISH message = MailMessage("*****@*****.**", "*****@*****.**", "", "") message.add_alternate_view(app.request_apointment()) msg = MapiMessage.from_mail_message(message) # Save the appointment as draft. msg.save(dataDir + "DraftAppointmentRequest_out.msg")