1

我正在尝试使用 OpenCMIS for C# 和 OpenKM Server 实现上传功能。我想允许上传特定目录中的现有文件,并具有如下内容:文件名、文件名(1)、文件名(2)等。OpenCMIS 不允许多个文件具有相同的名称(我得到:Apache Chemistry OpenCMIS - nameConstraintViolation 错误)。我可以检查目录中的所有文件名并解析它们的名称,但这似乎不是最好的解决方案。

我也尝试过,在创建要设置的文档时

IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = documentName;
properties[PropertyIds.ObjectTypeId] = "cmis:document";
properties[PropertyIds.ContentStreamId] = 1;

ContentStream contentStream = new ContentStream();
contentStream.MimeType = MimeTypes.GetMimeType(fileName);
contentStream.Length = memStream.Length;
contentStream.Stream = memStream;


IDocument doc = resourceFolder.CreateDocument(properties, contentStream, null);

但我得到的属性 ContentStreamId 为 null,并以这种方式跟踪具有相同名称但不同版本的现有文件。我不知道对文件进行版本控制是否会对我有所帮助,因为我还想允许列出文件夹中的文件并下载它们。这样做有更好的主意吗?

4

0 回答 0