【问题标题】:Creating a document with multy-value Property in Alfresco using DotCMIS使用 DotCMIS 在 Alfresco 中创建具有多值属性的文档
【发布时间】:2024-05-03 18:15:02
【问题描述】:

就像上面建议的那样,我尝试使用 DotCMIS 和 Visual Studio 2010 在 Alfresco CMS 中创建具有多值属性的文档

Dictionary<string, object> DocumentProperties = new Dictionary<string, object>();
DocumentProperties[PropertyIds.Name] = "MyPDF.pdf";
DocumentProperties[PropertyIds.ObjectTypeId] = "D:mit:mypdf";
DocumentProperties["mit:author"] = "myPDFAuthor";
DocumentProperties["mit:serialnumber"] = "23A100001";

ContentStream contentStream = new ContentStream();
contentStream.FileName = "MyPDF.pdf";
contentStream.MimeType = "application/pdf";
contentStream.Stream = new MemoryStream(File.ReadAllBytes("C:/mypath/mypdf.pdf"));
IDocument doc = root.CreateDocument(DocumentProperties, contentStream, DotCMIS.Enums.VersioningState.Major);

就其而言,这没有问题。

DocumentProperties["mit:gesamtwert"] = ???

问题从这里开始。 “mit:gesamtwert”是一个多值属性(数据类型:float),我不知道如何以正确的方式传递值。我尝试了 List、float[] 和其他几个......我错过了什么吗?我看到一些使用 ArrayList 的 java 解决方案,但我无法将其转换为工作集。

如果我尝试传递单个浮点值,当然会出现

System.ArgumentException: Property 'mit:gesamtwert' is not a single value property!

如果我传递数组或列表

System.ArgumentException: Property 'mit:gesamtwert' is a Decimal property!

所以它只是不识别数组或列表的列表字符并将其解释为单个值,这显然不是浮点数。

非常感谢任何帮助!在此先感谢您的帮助! 重新设计

【问题讨论】:

    标签: c# alfresco dotcmis


    【解决方案1】:

    对于多值十进制属性,您必须使用List&lt;decimal&gt;。 CMIS 中不存在浮点数。请改用小数。

    【讨论】:

    • rofl,如果它被定义为小数,为什么他们将属性命名为 float?感谢您的帮助,现在工作顺利!
    最近更新 更多