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><cmisrabject><cmisroperties><cmisropertyId propertyDefinitionId="cmisbjectTypeId"><cmis:value>cmis:document</cmis:value></cmisropertyId></cmisroperties></cmisrabject></entry>
thanks for the tip with "alfresco/cmisatom" vs "alfresco/s/cmis". I was using the old URL all the time. The old CMIS interface did not guess the right mime type of a content stream, not even if the mimetype was "application/octet-stream". The new one does. (using V4.2.d)