gpt4 book ai didi

c# - 通过 C# 在 Lotus Notes 中预订房间

转载 作者:行者123 更新时间:2023-11-30 17:56:56 28 4
gpt4 key购买 nike

我正在尝试通过 C# 从下面的代码在 Lotus Notes 中预订房间。

我目前的代码:

//First, create a new Lotus Notes Session Object
Domino.NotesSession LNSession = new Domino.NotesSession();
//Next add a Database and a Document Object (not new)
Domino.NotesDatabase LNDatabase;
Domino.NotesDocument LNDocument;

//Initialize your Session with your Password
LNSession.Initialize("qwerty");
//Connect to your Notes Server and the path of your
//.nsf File (in my case its in a subfolder 'mail').
LNDatabase = LNSession.GetDatabase("Clone/testdomain", "mail\\asystem.nsf", false);
//Create an in memory document in the server database
LNDocument = LNDatabase.CreateDocument();
//-------Assign Field Values-------
//Define Start&End Date+Time of your appointment
//Year, Month, Day, Hour, Minute and Second
System.DateTime StartDate = new DateTime(2012, 12, 03, 17, 15, 0);
System.DateTime EndDate = new DateTime(2012, 12, 03, 17, 30, 0);
//This Defines that it is an Calendar Entry
LNDocument.ReplaceItemValue("Form", "Appointment");
LNDocument.ReplaceItemValue("Location", "Home");
LNDocument.ReplaceItemValue("Room", "Testroom/TestSite");
LNDocument.ReplaceItemValue("AppointmentType", "3");
//Type of the appointment, means:
//0 = Date, Appointment
//1 = Anniversary
//2 = All Day Event (Do Not Set Time Here!)
//3 = Meeting
//4 = Reminder
//5 = Date (Special, experimental!)
// Title of your entry
LNDocument.ReplaceItemValue("Subject", "hello Sir");
// Set Confidential Level (Public=1 or Private=0)
LNDocument.ReplaceItemValue("$PublicAccess", "1");
//Add Start&End Time of your event
LNDocument.ReplaceItemValue("CALENDARDATETIME", StartDate);
LNDocument.ReplaceItemValue("StartDateTime", StartDate);
LNDocument.ReplaceItemValue("EndDateTime", EndDate);
LNDocument.ReplaceItemValue("StartDate", StartDate);
LNDocument.ReplaceItemValue("MeetingType", "1");
//Infos in The Body
LNDocument.ReplaceItemValue("Body", "Body Text Body Text ...");
//Add an alarm to your appointment
LNDocument.ReplaceItemValue("$Alarm", 1);
LNDocument.ReplaceItemValue("$AlarmDescription", "hello world (alarm)");
LNDocument.ReplaceItemValue("$AlarmMemoOptions", "");
//-5 = Time (in minutes) before alarm goes on
LNDocument.ReplaceItemValue("$AlarmOffset", -5);
LNDocument.ReplaceItemValue("$AlarmSound", "tada");
LNDocument.ReplaceItemValue("$AlarmUnit", "M");
//This saves your Document in the Notes Calendar
LNDocument.ComputeWithForm(true, false);
LNDocument.Save(true, false, false);

它在客户端正确创建 session ,但在资源数据库上它不会将时间和日期保存到指定的房间。我到处寻找此类问题的代码示例,但一无所获。

最佳答案

我想从头开始,您应该使用 NotesDateTime 对象而不是 System.DateTime。像这样的……

Domino.NotesDateTime datetime = LNSession.CreateDateTime("3.12.2012 17:15");
LNDocument.ReplaceItemValue("CALENDARDATETIME", datetime.LSLocalTime); //maybe GetLSLocalTime...

希望对你有帮助,JiKra

关于c# - 通过 C# 在 Lotus Notes 中预订房间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13702253/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com