2016-05-20 22 views
2

像上面我嘗試創建與Alfresco的CMS多值屬性的文件,使用DotCMIS和Visual Studio 2010創建使用DotCMIS

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); 

建議儘可能在露天與MULTY值屬性的文件好,這個工作沒有問題。

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! 

所以它只是不認識的數組列表字符或列出並將其解釋爲單個值,這顯然不是浮點數。

任何幫助都是很贊!在此先感謝您的幫助! reineke

回答

4

對於多值小數屬性,您必須使用List<decimal>。 CMIS中不存在浮點數。改用小數。

+0

rofl,爲什麼地獄他們命名屬性浮動,如果它被定義爲十進制?感謝您的幫助,現在工作順利! –