cancel
Showing results for 
Search instead for 
Did you mean: 

Create cmis:document with CMIS

barbidure
Champ in-the-making
Champ in-the-making
Hello,

I would like to create a document in Alfresco with CMIS protocol.

For this, I use the following XML file :

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" >

   <author><name>admin</name></author>

   <summary>Presentation.</summary>

   <title>monDocument.pdf</title>

   <cmisra:object>

      <cmis:properties>

         <cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId>

      </cmis:properties>

   </cmisra:object>

</entry>


That, I send to Alfresco with curl command :
curl -X POST -uadmin:test "http://localhost:8080/alfresco/s/cmis/p/Sites/epnum/documentLibrary/Folder/children" -H "Content-Type:application/atom+xml" -d @createContent.xml


The document is created in Alfresco.

But when I try to create other properties, such as:

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" >

   <author><name>admin</name></author>

   <summary>Presentation.</summary>

   <title>monDocument.pdf</title>

   <cmisra:object>

      <cmis:properties>

         <cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId>

         <cmis:propertyInteger propertyDefinitionId="cmis:contentStreamLength" displayName="Content Stream Length" queryName="cmis:contentStreamLength"><cmis:value>98495335</cmis:value></cmis:propertyInteger>

         <cmis:propertyString propertyDefinitionId="cm:title" displayName="Titre" queryName="cm:title"><cmis:value>Mon titre</cmis:value></cmis:propertyString>

      </cmis:properties>

   </cmisra:object>

</entry>



The properties cm:title and cm:contentSteamLength are not taken into account when creating.
The same problem arises with the aspects.

Have you an idea of the problem? Or a problem?

BR
2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator
cm:tilte is a property of cm:tilted aspect.if you want to add cm:title property to your node ,you should apply cm:titled aspect to your node first(by adding <alf:setAspects> elements to your entry)
By cmis:contentStreamLength I guess it is computed from cmisra:content base64 string .If your atom entry dosen't have cmisra:content element  then cmis:contentStreamLength will be set to 0;

barbidure
Champ in-the-making
Champ in-the-making
In fact, if I do the test with this XML file. It work!


<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" >
   <author><name>admin</name></author>
   <summary>Presentation.</summary>
   <title>monDocument.pdf</title>
   <cmisra:object>
      <cmis:properties>
         <cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId>
            <alf:setAspects>
               <alf:aspectsToAdd>P:cm:titled</alf:aspectsToAdd>
               <alf:properties>
                  <cmis:propertyString propertyDefinitionId="cm:title"><cmis:value>MYTITLE</cmis:value></cmis:propertyString>
               </alf:properties>
            </alf:setAspects>
      </cmis:properties>
   </cmisra:object>
</entry>


Thank for your answer.