我前段時間使用C#創建了一個程序,該程序爲完全不同的程序執行了一些自動化操作,但發現需要從Lotus Notes數據庫訪問數據。唯一的問題是,我似乎只能弄清楚如何通過服務器的名稱(使用session.GetDatabase())打開數據庫...我無法弄清楚如何通過副本ID打開它。有誰知道我會怎麼做? (我不希望我的程序每次服務器更改下去。)通過C#中的副本ID打開Lotus Notes數據庫
public static string[] GetLotusNotesHelpTickets()
{
NotesSession session = new NotesSession();
session.Initialize(Password);
// 85256B45:000EE057 = NTNOTES1A Server Replica ID
NotesDatabase database = session.GetDatabase("NTNOTES1A", "is/gs/gshd.nsf", false);
string SearchFormula = string.Concat("Form = \"Call Ticket\""
, " & GroupAssignedTo = \"Business Systems\""
, " & CallStatus = \"Open\"");
NotesDocumentCollection collection = database.Search(SearchFormula, null, 0);
NotesDocument document = collection.GetFirstDocument();
string[] ticketList = new string[collection.Count];
for (int i = 0; i < collection.Count; ++i)
{
ticketList[i] = ((object[])(document.GetItemValue("TicketNumber")))[0].ToString();
document = collection.GetNextDocument(document);
}
document = null;
collection = null;
database = null;
session = null;
return ticketList;
}
此代碼工作正常,但如果從NTNOTES1A改變了服務器,那麼沒有什麼會再工作。
如此悲傷......我不能相信他們不會在小功能添加。我猜如果我要循環訪問服務器名稱,副本ID可能是不必要的。感謝您的答案...看起來我必須做任何服務器名稱列表。嘆氣 - 爲什麼不能記錄API的容易? – Sivvy 2009-09-11 18:02:17