Lotus notes 通过Lotus Notes创建重复约会

Lotus notes 通过Lotus Notes创建重复约会,lotus-notes,recurring,appointment,Lotus Notes,Recurring,Appointment,谁能告诉我这里怎么了。我正在尝试创建一个定期约会;但是,代码会创建一些不同的内容(类型不是约会),如果我选择一个创建的元素,它会抛出一个错误: Falscher Datentyp für运算符order@Funktion:Text Erwarett 我已经尝试了各种方法来查找错误,但我是Lotus Notes的新手,没有足够的文档(或者我找不到)。在LotusScript中创建约会已经不容易了。但是创建重复约会是非常高级的东西,因为它们不是要创建的单个文档,而是一个主文档和至少一个响应文档的组合

谁能告诉我这里怎么了。我正在尝试创建一个定期约会;但是,代码会创建一些不同的内容(类型不是约会),如果我选择一个创建的元素,它会抛出一个错误:

Falscher Datentyp für运算符order@Funktion:Text Erwarett


我已经尝试了各种方法来查找错误,但我是Lotus Notes的新手,没有足够的文档(或者我找不到)。在LotusScript中创建约会已经不容易了。但是创建重复约会是非常高级的东西,因为它们不是要创建的单个文档,而是一个主文档和至少一个响应文档的组合

要获得正确的结果,您需要创建一组具有正确数据类型和内容的字段

在您的示例中,至少包括StartDate、StartTime、EndDate、EndTime和CalendarDate字段。。。他们失踪了。您的“Computewithform”尝试从使用过的表单中计算所有缺少的字段。但它们需要一些字段,并且必须是正确的类型,否则您会得到@Formula-错误(在您的情况下,这可能是因为您将Repeats设置为Number,但它应该是一个文本,但他的错误只是我在您的代码中看到的第一个错误,可能还有其他错误)

有一个PDF文档名为that is very old(2006),但仍然适用:它描述了如何以编程方式创建日历条目,以及您需要哪些字段以及它们的含义……阅读、理解、使用它


这是在不猜测或复制现有文档的情况下获取有效日历项的唯一方法…

谢谢你,托尔斯滕,你有关于如何处理重复异常的信息吗?这都在该模式中…你需要创建至少两个响应:一个在异常之前有所有实例,另一个在异常之后有所有实例e例外。。。
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();

    //Normal Meeting
    NotesDocument document = database.CreateDocument();

    UpdateAppointment(document, session);

    //Repeating Meeting
    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); 
}