就像上面建议的那样,我尝试使用 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!
所以它只是无法识别数组或列表的列表字符并将其解释为单个值,这显然不是 float 。
非常感谢任何帮助!在此先感谢您的帮助! 雷内克
最佳答案
对于多值十进制属性,您必须使用 List<decimal>
。 CMIS 中不存在 float 。请改用小数。
关于c# - 使用 Dot CMIS 在 Alfresco 中创建具有多值属性的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37347870/