我想以编程方式将表格从一个 NSF 复制到另一个 NSF。我知道 NotesDocument 类具有 CopyToDatabase 方法,而 NotesDatabase 类具有 CreateView 方法。
但是,我还没有找到任何可以让我向 NSF 添加表单的内容。
我正在使用 Lotus Notes 8.5.2、COM 和 C#。
我可以毫无问题地检索有关表单的信息或删除它们,并且我有以下代码片段:
//NotesConnectionDatabase and nd2 are objects of type NotesDatabase and are
//members of the same session.
//Write the name of each form to the console.
//Delete each form from the database.
for (int i = 0; i <= (((object[])NotesConnectionDatabase.Forms)).Length - 1; i++)
{
Console.WriteLine(((NotesForm)((object[])NotesConnectionDatabase.Forms)[i]).Name);
((NotesForm)((object[])NotesConnectionDatabase.Forms)[i]).Remove();
}
//For each form in nd2, copy the form to NotesConnectionDatabase.
for (int j = 0; j <= (((object[])nd2.Forms)).Length - 1; j++)
{
//I am aware that there is no such method as NotesForm.CopyToDatabase
((NotesForm)((object[])nd2.Forms)[j]).CopyToDatabase(NotesConnectionDatabase);
}