Support Portal ContactGet in touch

SharePoint Client Object Model – Max Message Size

   Words by CRM Consultancy

   on 02/11/2016 11:00:00

imageThe SharePoint Client Object Model allows common SharePoint operations to be performed using a simple lightweight Webservice - and so is very useful when working with Apps that integrate with SharePoint, such as Dynamics CRM and Portals.

Client Object Model - This was introduced in SharePoint 2010 and then carried over into future versions of SharePoint.

However if you use the SharePoint Object Model to allow your App or Service to upload Documents or other Files to SharePoint then you notice the following error:

Error whilst Uploading Document: The request message is too big. The server does not allow messages larger than 2097152 bytes.

This is because the Default Setting for the Client Object Model in SharePoint 2013 is to limit single uploads to around 2MB in size. (2,097,512 bytes)

To overcome this limitation, we have two options:

  • Rework our integration to 'chunk' a file into several smaller uploads. (as opposed to a larger single upload)
  • Raise the 2Mb limit in SharePoint using a PowerShell Script.

If we look at how we can raise this limit, we need to run the following script past the SharePoint PowerShell:

$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 10485769
$ws.ClientRequestServiceSettings.MaxParseMessageSize  = 10485769

This will raise the maximum upload size to 10MB for the Client Object Model.

(not to be confused with general SharePoint Uploads which are controlled by the relevant setting in the Sites Virtual Application or individual Document Library)

With this place, we can now see our larger uploads via the Client Object Model taking place successfully:


The Client Object Model and Client-side Services are great components of SharePoint, and so the following articles and further reading may well be useful information on the topic.

Further Reading

Understanding the SharePoint 2010 Client Object Model

SharePoint 2013 .NET Server CSOM, JSOM and REST API Index

Using the Client Object Model

  • "Paul has made a real difference to how my team of 24 people record and store valuable customer data and sales opportunities. Highly recommended."

    James, Operations Director

  • "Understanding your business allows us to advise when to implement aspects of CRM and, likewise, when not to."

    Paul McQuillan, Managing Director

  • "Dynamics 365 and CRMCS have made a real lasting difference to our business, allowing us to replace older systems that were holding back our performance."

    Grahame, Chief Operating Officer

  • "James worked well with us to help connect CRM with Outlook and relate how this might benefit our team using CRM for Property Care."

    Natalie, Property Care Supervisor

  • "Matt was really good with helping us run User Testing on the new Compliance Module of our CRM System."

    Tom, Compliance Administrator

Prefer to go old-school?

Write to us using the below addresses.

Head Office
CRM Consultancy
61 Oxford Street
M1 6EQ

London Office
CRM Consultancy London
Grosvenor Avenue

Content © CRM Consultancy.