12-11-2015 02:19 AM
public String uploadDocument(String docType, File file) throws IOException, SiteNotFoundException, DocumentLibraryNotFoundException {
Map<String, String> props = new HashMap<String, String>();
props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
props.put(PropertyIds.NAME, file.getName());
FileInputStream input = new FileInputStream(file);
CUDDocuments docsCUD = new CUDDocuments();
Folder target = docsCUD.getTargetFolder(docType);
ContentStream contentStream = MySession.getSession().getObjectFactory()
.createContentStream(file.getName(), -1,
"application/octet-stream", input);
Document doc = target.createDocument(props, contentStream, VersioningState.MAJOR);
contentStream.getStream().close();
return doc.getId();
}
12-11-2015 07:25 AM
12-14-2015 09:00 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.