在我的存储库中,我将文档放入单独的文件夹中
我想要的是当用户再次推送相同的文档时,我需要检查该文档是否已经存在于对应的文件夹中,如果该文档已经存在,那么我需要增加该文档的版本。
这是我到目前为止的工作
var bookingIndex = (Folder)session.GetObjectByPath("/Root"); // the folder that contain all booking folders
var bookingReference = "REF0001"; // payload booking reference number
List<IFolder> BookingFolderArray = new List<IFolder>();
//gets all folders inside the path above ("Ex : /Root");
foreach (ICmisObject cmisObject in bookingIndex.GetChildren())
{
if (cmisObject is IFolder) // check only for folders inside /Root
{
Folder folder = cmisObject as Folder;
if (folder.Name.Equals(bookingReference)) // check for the folder has same booking reference number
{
BookingFolderArray.Add(folder);
break;
}
}
}
我正在尝试使用以下代码段获取文档但没有成功
List<IDocument> BookingDocuments = new List<IDocument>(); // holder for documents
foreach (ICmisObject cmisObject in BookingFolderArray[0].GetChildren()) // loop through children
{
if (cmisObject is IDocument) // check only for documents
{
IDocument document = cmisObject as IDocument;
BookingDocuments.Add(document);
}
}
如何在 BookingFolderArray[0] 中获取文档。在这里,我认为我正在做正确的方式,否则请纠正我