AnsweredAssumed Answered

Not able to set custom aspect property on document

Question asked by kartech11 on Aug 29, 2018
Latest reply on Aug 30, 2018 by sepgs2004



I am currently using CMIS to create documents. I see lot of examples that update for aspect properties or custom properties on the document by updating the properties map and passing it to createDocument API


Do these documents need to have any aspect associated upfront before I set a custom property? 


I am currently setting a custom property but I get the below error

ObjectId idOfCheckedOutDocument = currentDocument.checkOut();
pwc = (Document) session.getObject(idOfCheckedOutDocument);
ByteArrayInputStream stream = new ByteArrayInputStream(newContent);
ContentStream contentStream = session.getObjectFactory().createContentStream(documentName, Long.valueOf(newContent.length), mimeType, stream);
ObjectId objectId = pwc.checkIn(true, properties, contentStream, "New version of document");

I had set the properties map with a custom property but I get the below exception . Is this because an aspect type s not associated to the document at some hierarchy?


Exception in thread "main" java.lang.IllegalArgumentException: Property 'myaspect:docStatus' is not valid for this type or one of the secondary types!
at org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl.convertProperties(
at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(