| void Main() |
| { |
| var session = new NotesSessionClass(); |
| session.Initialize(""); |
| var mailFile = session.GetEnvironmentString("MailFile", true); |
| var server = session.GetEnvironmentString("MailServer", true); |
| |
| NotesDatabase database = session.GetDatabase("", mailFile, false); |
| if(!database.IsOpen) |
| database.Open(); |
| |
| |
| NotesDocument document = database.CreateDocument(); |
| |
| UpdateAppointment(document, session); |
| |
| |
| DateTime appointmentStart = new DateTime(2020, 5, 13, 15, 0, 0); |
| DateTime appointmentEnd = new DateTime(2020, 5, 13, 16, 0, 0); |
| |
| List<DateTime> repeatStart = new List<DateTime>(){ appointmentStart, appointmentStart.AddDays(1), appointmentStart.AddDays(2), appointmentStart.AddDays(3) }; |
| List<DateTime> repeatEnd = new List<DateTime>(){ appointmentEnd, appointmentEnd.AddDays(1), appointmentEnd.AddDays(2), appointmentEnd.AddDays(3) }; |
| |
| document.ReplaceItemValue("Repeats", 1); |
| document.ReplaceItemValue("OrgRepeat", 1); |
| document.ReplaceItemValue("$CSFlags", "i"); |
| |
| NotesDocument repeatingMaster = database.CreateDocument(); |
| UpdateAppointment(repeatingMaster, session); |
| repeatingMaster.ReplaceItemValue("Repeats", 1); |
| repeatingMaster.ReplaceItemValue("OrgRepeat", 1); |
| repeatingMaster.ReplaceItemValue("$CSFlags", "c"); |
| |
| repeatingMaster.ReplaceItemValue("RepeatStartDate", appointmentStart); |
| repeatingMaster.ReplaceItemValue("RepeatHow", "F"); |
| repeatingMaster.ReplaceItemValue("RepeatFor", 4); |
| repeatingMaster.ReplaceItemValue("RepeatForUnit", "D"); |
| |
| repeatingMaster.ReplaceItemValue("RepeatUnit", "D"); |
| repeatingMaster.ReplaceItemValue("RepeatInterval", 1); |
| |
| repeatingMaster.ReplaceItemValue("RepeatDates", repeatStart.ToArray()); |
| repeatingMaster.ReplaceItemValue("RepeatInstanceDates", repeatStart.ToArray()); |
| repeatingMaster.ReplaceItemValue("RepeatEndDates", repeatEnd.ToArray()); |
| repeatingMaster.ReplaceItemValue("RepeatUntil", repeatEnd.Last()); |
| |
| repeatingMaster.ReplaceItemValue("StartDateTime", repeatStart.First()); |
| repeatingMaster.ReplaceItemValue("EndDateTime", repeatEnd.First()); |
| repeatingMaster.ReplaceItemValue("StartTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=90$ZN=Romance"); |
| repeatingMaster.ReplaceItemValue("EndTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=90$ZN=Romance"); |
| repeatingMaster.ReplaceItemValue("ApptUNID", repeatingMaster.UniversalID); |
| |
| repeatingMaster.ComputeWithForm(false, false); |
| repeatingMaster.Save(true, false); |
| |
| document.ReplaceItemValue("CalendarDateTime", repeatStart.ToArray()); |
| document.ReplaceItemValue("StartDateTime", repeatStart.ToArray()); |
| document.ReplaceItemValue("EndDateTime", repeatEnd.ToArray()); |
| document.ReplaceItemValue("RepeatInstanceDates", repeatStart.ToArray()); |
| document.ReplaceItemValue("StartTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=90$ZN=Romance"); |
| document.ReplaceItemValue("EndTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=90$ZN=Romance"); |
| |
| document.ReplaceItemValue("$Ref", repeatingMaster.UniversalID); |
| document.ReplaceItemValue("$RefOptions", 1); |
| document.ReplaceItemValue("ApptUNID", repeatingMaster.UniversalID); |
| |
| document.ComputeWithForm(false, false); |
| document.Save(true, false); |
| |
| } |
| |
| void UpdateAppointment(NotesDocument document, NotesSession session) |
| { |
| document.ReplaceItemValue("Form", "Appointment"); |
| document.ReplaceItemValue("$CSVersion", 2); |
| document.ReplaceItemValue("Subject", "Subject"); |
| document.ReplaceItemValue("Body", "Body"); |
| document.ReplaceItemValue("AppointmentType", 3); |
| |
| document.ReplaceItemValue("Chair", session.UserName); |
| document.ReplaceItemValue("Principal", session.UserName); |
| document.ReplaceItemValue("From", session.UserName); |
| |
| document.ReplaceItemValue("SequenceNum", 1); |
| |
| document.ReplaceItemValue("RequiredAttendees", "test@required.attendee"); |
| document.ReplaceItemValue("Location", "Location"); |
| document.ReplaceItemValue("$Alarm", 1); |
| document.ReplaceItemValue("Alarms", 1); |
| document.ReplaceItemValue("$AlarmOffset", -15); |
| |
| document.ReplaceItemValue("$BusyName", session.UserName); |
| document.ReplaceItemValue("$BusyPriority", 1); |
| |
| document.ReplaceItemValue("$PublicAccess", 1); |
| document.ReplaceItemValue("Importance", 1); |
| |
| |
| |
| |
| |
| document.ComputeWithForm(false, false); |
| document.Save(true, false); |
| } |