当前位置: 动力学知识库 > 问答 > 编程问答 >

Unable to upload docs greater than 37 MB through CMIS API in SharePoint 2013

问题描述:

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 get an Exception - '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");

props.put("cmis:name",fileName);

String mimetype = "application/octet-stream";

ContentStream contentStream = session.getObjectFactory().createContentStream(fileName,

file.length(),

mimetype,

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 ?

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Found

at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:487)

at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:629)

at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:119)

at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:751)

at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:95)

at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:469)

at UploadLargeFile.main(UploadLargeFile.java:31)

Where this 31st line corresponds to "Document someDoc = someFolder.createDocument(props, contentStream, versioningState );"

网友答案:

Check the maximum allowed limit in web.config files at 3 locations :

To solve this problem, you need to increase maxRequestLength value in three places on the TARGET farm:

  • Central Administration web.config file (typically located in C:\Inetpub\wwwroot\wss\VirtualDirectories\DirectoryName)

  • Your web application main web.config file (typically located in C:\Inetpub\wwwroot\wss\VirtualDirectories\DirectoryName).

  • Content deployment web.config file located in: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\ADMIN\Content Deployment

Open web.config file located at each location and locate the maxRequestLength attribute. Increase it to allow upload of the largest CAB file that you have. The default setting limits the upload file size to 51200 KB for CA and web application and to 102400 KB for content deployment.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength=”102400″ />
  </system.web>
</configuration>
分享给朋友:
您可能感兴趣的文章:
随机阅读: