AnsweredAssumed Answered

.NET WCF and createDocument

Question asked by newtechfool on Mar 27, 2012
Latest reply on Mar 31, 2012 by newtechfool
I am having a problem adding documents to Alfresco using the createDocument method. I am using the public Alfresco 4.x CMIS Content Repository for testing (http://cmis.alfresco.com/)

I can query, view, delete, update etc. I can also add documents using the code below to other CMIS vendor repositories, but with Alfresco I get an error:
Property cmis:objectTypeId must be set!

The following is sample code to reproduce issue:

       Dim ws As New WS_CMIS.ObjectServicePortClient(….)
        ws.ClientCredentials.UserName.UserName = "admin"
        ws.ClientCredentials.UserName.Password = "admin"

        Dim props As New cmisPropertiesType()

        Dim propName As New cmisPropertyString
        propName.propertyDefinitionId = "cmis:name"
        propName.value = New String() {"Test"}

        Dim propClass As New cmisPropertyString
        propClass.propertyDefinitionId = "cmis:objectTypeId"
        propClass.value = New String() {"cmis:document"}

        props.Items = New cmisProperty() {propClass, propName}

        Dim stream As New cmisContentStreamType()
        stream.stream = FileUpload1.FileBytes
        stream.mimeType = FileUpload1.PostedFile.ContentType
        stream.filename = FileUpload1.FileName
        stream.length = FileUpload1.PostedFile.ContentLength

        ws.createDocument("371554cd-ac06-40ba-98b8-e6b60275cca7", props, "workspace://SpacesStore/87b2f129-3ad0-4a46-a6ea-05ecbfb54aa1", stream, enumVersioningState.major, Nothing, Nothing, Nothing, Nothing)

I have checked forums, but have not been able to find an answer.

Outcomes