AnsweredAssumed Answered

Document property update CMIS

Question asked by sumantapakira on Jan 16, 2013
Latest reply on Mar 26, 2013 by nick.l
Hi All,

I'm trying to update property of a document in Alfresco repository using CMIS. For that I've written below code but I'm getting error Property 'cm:description' is not valid for this type!
Folder newFolder = root.createFolder(folderProperties);
String name = "testdata5.text";
Map<String, Object> contentProperties = new HashMap<String, Object>();
contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
contentProperties.put(PropertyIds.NAME, name);
contentProperties.put("cm:description", "Test");
byte[] content = "This is a test".getBytes();
InputStream stream = new ByteArrayInputStream(content);
ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
Document document = newFolder.createDocument(contentProperties, contentStream, null);

But when I'm executing a POST by using culr then it is correctly setting Description
curl -X POST -uadmin:admin "http://localhost:8080/alfresco/s/cmis/p/testfolder5/children" -H "Content-Type: application/atom+xml" -d @C:\Books\CMIS\test.atom.xml, then it is setting description correctly. test.atom.xml looks below -
<?xml version="1.0" encoding="utf-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasisopen.org/ns/cmis/restatom/200908/"
xmlns:cmis="http://docs.oasisopen.org/ns/cmis/core/200908/"><title>sample.doc</title><summary>A sample Doc</summary>
<content type="application/text"></content><cmisra:object><cmis:properties><cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId></cmis:properties></cmisra:object></entry>

Can someone please advice!!

Outcomes