My SharePoint 2013 version is 15.0.4569.1506. I am unable to upload a document greater than 37 MB in SharePoint through my below CMIS code. But directly into SharePoint I am able to do so. I have also tried increasing my heap size / cache limits.

I receive an exception like this:

'CmisRuntimeException : Found'

Folder someFolder = (Folder) session.getObjectByPath("/TestFolder");

File file = new File("C:/Users/Administrator/Desktop/50MBFile.zip"); 
String fileName = file.getName();

Map<String, Object> props = new HashMap<String, Object>();
props.put("cmis:objectTypeId", "cmis:document");

String mimetype = "application/octet-stream";

ContentStream contentStream = session.getObjectFactory().createContentStream(fileName,
                new FileInputStream(file));

VersioningState versioningState = null;

Document someDoc = someFolder.createDocument(props, contentStream, versioningState );

I have used AtomPub Binding. Is something wrong in my code or any other SharePoint/CMIS setting I need to change ?

The code for Session Creation :

String atompub_url = "http://myserver/_vti_bin/cmis/rest/repository_id?getRepositoryInfo";
String username ="username";
String password = "password";

//put everything into a HashMap
Map<String, String> parameter = new HashMap<String,String>();

parameter.put(SessionParameter.PASSWORD, password);
parameter.put(SessionParameter.ATOMPUB_URL, atompub_url);

parameter.put(SessionParameter.COOKIES, "true")
parameter.put(SessionParameter.COMPRESSION, "true")
parameter.put(SessionParameter.CACHE_TTL_OBJECTS, "5000")
parameter.put(SessionParameter.CACHE_TTL_PATHTOID, "5000")

parameter.put(SessionParameter.REPOSITORY_ID, "F6497840-5DE3-464E-B8B3-45AF629823B1");

parameter.put(SessionParameter.CONNECT_TIMEOUT, "999999");
parameter.put(SessionParameter.READ_TIMEOUT, "999999");

SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.createSession(parameter);
  • Could you please also include the code that creates the session object, including the CMIS URL? (you can randomize the domain name). Cheers! – Nicolas Raoul Apr 15 '16 at 2:00

My issue is resolved. I used Fiddler and found that I was exceeding the maximum request length allowed by SharePoint. I changed the value of maxRequestLength attribute in web.config files in SharePoint and able to now upload large files.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.