3

我正在尝试从下面的代码中通过 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);

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

4

1 回答 1

1

From the scratch i guess, you should use a NotesDateTime object instead of System.DateTime. Something like this...

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

Hope it will help, JiKra

于 2012-12-10T21:34:59.350 回答