【问题标题】:Book a room in Lotus Notes via C#通过 C# 在 Lotus Notes 中预订房间
【发布时间】:2012-12-04 11:50:10
【问题描述】:

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

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

【问题讨论】:

    标签: c# lotus-notes


    【解决方案1】:

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

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

    希望它会有所帮助,JiKra

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 1970-01-01
      • 2014-07-08
      • 1970-01-01
      相关资源
      最近更新 更多