As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
import org.apache.chemistry.opencmis.commons.* import org.apache.chemistry.opencmis.commons.data.* import org.apache.chemistry.opencmis.commons.enums.* import org.apache.chemistry.opencmis.client.api.* def cmis = new scripts.CMIS(session) Folder newFolder = cmis.getFolder("/"); final String textFileName = "test.txt"; String mimetype = "text/plain; charset=UTF-8"; String content = "This is some test content"; String filename = textFileName; byte[] buf = content.getBytes("UTF-8"); ByteArrayInputStream input = new ByteArrayInputStream(buf); ContentStream contentStream = session.getObjectFactory().createContentStream(filename, buf.length, mimetype, input); Map<String, Object> props = new HashMap<String, Object>(); props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document"); props.put(PropertyIds.NAME, "filename"); Document doc = newFolder.createDocument(props, contentStream, VersioningState.MAJOR);