Search code examples
c#alfrescodotcmis

Creating a document with multy-value Property in Alfresco using DotCMIS


like suggested above im trying to create a document with a multi-value property in Alfresco CMS, using DotCMIS and Visual Studio 2010

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

as far as good, this works without problems.

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

here the problem starts. "mit:gesamtwert" is a multi-value property (data type:float), and I can't figure out, how to pass the values in the correct way. I tried List, float[] and several others... am I missing something? I saw some java-solutions wroking with ArrayList but i couldn't transform that into a working set.

if i try to pass single float values of course there comes

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

if i pass the array or the List

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

so it just doesnt recognize the list-character of the array or list and interpreting it as a single value, that is obviously not a float.

any help is much apreciated! thanks in advance for your help! reineke


Solution

  • For multi-value decimal properties you have to use a List<decimal>. Float doesn't exist in CMIS. Use decimal instead.