【问题标题】:How to Check Document Already exists in repository folder using DotCMIS如何使用 DotCMIS 检查存储库文件夹中是否已存在文档
【发布时间】:2019-12-03 07:43:15
【问题描述】:

在我的存储库中,我将文档放入单独的文件夹中

我想要的是当用户再次推送同一个文档时,我需要检查该文档是否已经存在于对应的文件夹中,如果该文档已经存在,那么我需要增加该文档的版本。

这是我到目前为止的工作

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] 中获取文档。 在这里我认为我正在做正确的方式,否则请纠正我

【问题讨论】:

    标签: cmis dotcmis


    【解决方案1】:

    如果您有一个nodeRef 的文档。

    尝试使用nodeRef 获取文档。如果它返回一个CmisObject 它已经存在,否则它不存在。

    【讨论】:

      猜你喜欢
      • 2010-12-10
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 2018-12-26
      • 1970-01-01
      • 2020-04-23
      • 1970-01-01
      • 2011-11-15
      相关资源
      最近更新 更多