Lotus Notes复制文档 - 保留折叠和未读

Jac*_*rry 1 c# com lotus-notes lotus lotus-domino

我在C#中构建了一个应用程序,它将文档从源NSF复制到目标NSF.目标NSF是一个空壳,保留所有设计元素,基于源NSF.我正在使用Lotus Notes 8.5.3并且未连接到Domino服务器.

我使用此应用程序将源NSF拆分为较小的块.目标是创建可由我们的自动(eDiscovery)系统有效处理的目标NSF.我需要确保保留尽可能多的元数据.

我现有的代码符合这些目标,但(1)我丢失了文件夹信息.复制文档后,所有文件夹都为空.(2)所有文件都标记为已读,即使它们在源中未读.

代码C#

//Establish session
NotesSession ns = new Domino.NotesSessionClass();
ns.Initialize("");

//Open source NSF
NotesDatabase nd = ns.GetDatabase("", "test.nsf", false);
//Open destination NSF.
//Assume that all design elements of nd2 are identical to those of nd
NotesDatabase nd2 = ns.GetDatabase("", "test2.nsf", false);

//Create view that returns all documents.
NotesView nView2 = nd.GetView("$All");
nd.CreateView("All-DR", "SELECT @ALL", nView2, false);
NotesView nView = NotesConnectionDatabase.GetView("All-DR");

//Loop through entries in the new view
NotesViewEntry nvec = nView.AllEntries;
nve = nvec.GetFirstEntry();

for (int j = 1; j <= intEntryCount; j++)
{
     if (j == 1)
     {
          nve = nvec.GetFirstEntry();
     }
     else
     {
          nve = nvec.GetNextEntry(nve);
     }

     //Copy document to second database.
     NotesDocument ndoc = nd.GetDocumentByUNID(nve.UniversalID);         
     ndoc.CopyToDatabase(nd2);
 }
 //End loop.
 //All documents are copied.
Run Code Online (Sandbox Code Playgroud)

结果是我最终得到了一个目标NSF,它复制了所有文件.假设所有文件夹也在那里.但是,文件夹中没有任何文件.每个文档都标记为已读.

如何修复文件夹和未读问题?

Ric*_*rtz 5

FolderReferences后端类中的NotesDocument类中有一个属性.我不是100%确定该属性是否在COM类中公开并且是C#的interop,但如果是,则可以将其与PutInFolder()方法一起使用以解决部分问题.

就读/未读标记而言,关键问题是您是否只关心自己的读/未读状态,或者您是否正在尝试为数据库的所有用户保留它.如果您只关心自己的未读标记,那么您可以使用该类的getAllUnreadDocuments()方法NotesDatabase- 但这需要Notes/Domino 8或更高版本(在您的代码运行的机器上),而且我不是确定此方法(或NotesNoteCollection它返回的类)是否通过C#的COM/interop接口公开.如果可用,则可以遍历集合并使用该MarkUnread()方法.如果您关心所有用户的未读标记,那么我不确定是否有办法完成 - 但如果有,则需要使用来自Notes C API的调用.