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.

https://msdn.microsoft.com/en-us/library/office/ee537247(v=office.14).aspx

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
$ws.Update()

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:

image

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

https://www.nothingbutsharepoint.com/2011/01/20/understanding-the-sp2010-client-object-model-aspx-2/

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

https://msdn.microsoft.com/en-us/library/office/dn268594.aspx

Using the Client Object Model

https://msdn.microsoft.com/en-us/library/ff798388.aspx

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

CRMCS Quick Start Guide: How To Produce a Microsoft Teams Live Event Dynamics 365 Marketing: Lead Scoring and Sales Acceptance Designing and Developing Microsoft Power Apps Portals Thank You for Attending CRMCS’ Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Thank You for Attending Our Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Webinar: Discover How CRMCS Have United Dynamics 365, SharePoint and Microsoft Teams To Create Sales Excellence Ignite your workflow by adding DocDrive365 to Office 365 The CRMCS guide to everything you need to know about integrating Teams with Dynamics 365 Saving Time By Keeping Documents In One Place TDE Database Encryption with On Premise Dynamics The Key to Successful Compliance in 2020 Part 2: Let’s get GDPR Compliant with Microsoft Power Automate Top 3 Essential Tips for Remote Working Dynamics 365 Marketing: Top 5 Best Features Dynamics Day in the Life - Puma Investments Can you use Teams to amplify collaboration in Dynamics? Part 1: Using a Scheduled Power Automate to Trigger Expiry Date Reminders The secrets of successful document collaboration in Dynamics CRMCS launches new AppSource approved DocDrive365 Dynamics Day in the Life - Moneypenny Release Management Add the App to Dynamics DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Building a New Scheduled Process using Flow
  • "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
Manchester
M1 6EQ

London Office
CRM Consultancy London
Grosvenor Avenue
London

Content © CRM Consultancy.