Adding a web part (or app part) via CSOM remote provisioning to a on-premise SharePoint web part page results in a

Specified argument was out of the range of valid values

exception when calling this method

webPartManager.AddWebPart(webPartToAdd, "RightColumnZone", 0);

I cannot find the issue. What am I doing wrong?


  • SharePoint 2013 on-premise
  • Visual Studio 2013
  • Provider-hosted app (but also tried console)


If I use the code from this example (Section Adding a web part to a page) it does not work:


Error log

One of the errors (there are a few variations of this but all basically the same "Specified argument was out of the range of valid values" issue) listed in ULS is this one:

Exception occured in scope Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager.AddWebPart. Exception=System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.    
 at Microsoft.SharePoint.WebPartPages.SPLimitedWebPartCollection.get_Item(Guid storageKey)    
 at Microsoft.SharePoint.SPObjectFactory.GetObjectById(String id)    
 at Microsoft.SharePoint.Client.ClientCallableObjectFactory.GetObjectByIdWithMonitoredScope(String objectId, ProxyContext proxyContext)    
 at Microsoft.SharePoint.Client.ClientMethodsProcessor.GetObjectFromObjectPath(XmlElement xe)    
 at Microsoft.SharePoint.Client.ClientMethodsProcessor.GetObjectFromObjectPathId(String objectPathId)    
 at Microsoft.SharePoint.Client.ClientMethodsProcessor.GetObjectFromObjectPath(XmlElement xe)    
 at Microsoft.SharePoint.Client.ClientMethodsProcessor.GetObjectFromObjectPathId(String objectPathId)    
 at Microsoft.SharePoint.Client.DataConverter.GetObject[T](XmlNode node, ProxyContext proxyContext)    
 at Microsoft.SharePoint.ServerStub.WebParts.SPLimitedWebPartManagerServerStub.AddWebPart_MethodProxy(SPLimitedWebPartManager target, XmlNodeList xmlargs, ProxyContext proxyContext)    
 at Microsoft.SharePoint.ServerStub.WebParts.SPLimitedWebPartManagerServerStub.InvokeMethod(Object target, String methodName, XmlNodeList xmlargs, ProxyContext proxyContext, Boolean& isVoid)    
 at Microsoft.SharePoint.Client.ServerStub.InvokeMethodWithMonitoredScope(Object target, String methodName, XmlNodeList args, ProxyContext proxyContext, Boolean& isVoid)

Also in ULS recorded is the actual CSOM request:

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="" LibraryVersion="" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
        <ObjectPath Id="102" ObjectPathId="101" />
        <ObjectIdentityQuery Id="103" ObjectPathId="101" />
        <Query Id="104" ObjectPathId="101">
            <Query SelectAllProperties="true">
                <Properties />
        <Method Id="101" ParentId="86" Name="AddWebPart">
                <Parameter ObjectPathId="95" />
                <Parameter Type="String">Top</Parameter>
                <Parameter Type="Int32">0</Parameter>
        <Method Id="86" ParentId="83" Name="GetLimitedWebPartManager">
                <Parameter Type="Enum">1</Parameter>
        <Property Id="95" ParentId="92" Name="WebPart" />
        <Identity Id="83" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:40a25464-4926-4fd8-946b-d3ec87744537:web:5596ddd1-34f6-4faa-991c-529597113203:file:/sites/contosopublishing/Pages/test.aspx" />
        <Identity Id="92" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:40a25464-4926-4fd8-946b-d3ec87744537:web:5596ddd1-34f6-4faa-991c-529597113203:file:/sites/contosopublishing/Pages/test.aspx:wpd:1,00000000-0000-0000-0000-000000000000" />

What have I tried?

Lots of different things, anything I could think of:

  • CSOM in provider-hosted app (high-trust) on dev on-premise environment
  • CSOM with console app (just to rule out app-connection issue but same error)
  • Using parts of this solution (this is JSOM but similar) How to add Client Web Parts (App Parts) to a page from JavaScript CSOM?

  • Using different versions of the Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime ( and

  • Flushing the cache explained here
  • Changing the ZoneID: As it might be an issue I made sure the zone on the page exists and also tried using "Right", "Right Column" or "RightColumnZone" as Zone IDs when adding the web part.

As the used XML code for adding the web part might be a factor I tried

  • The XML of this MS example (Section: Adding a web part to a page)
  • The XML export of a web part added using the UI (mentioned here)
  • The markup usually used for adding it directly in the aspx page like mentioned here but that gave the expected error of invalid xml format
  • Did you ever get this sorted out? I'm running into the exact same problem. Only difference is that I'm hitting SharePoint Online.
    – Aaron
    Apr 10, 2015 at 21:08
  • I am also using SharePoint online and getting the same Issue
    – DvG
    Oct 5, 2017 at 7:47

1 Answer 1


I had a chunk of code that was working, then moved things around to tidy it up, and suddenly I faced this same error when trying to add a webpart. It took me forever, but eventually it appears that I had to check my page out BEFORE I created the LimitedWebPartManager, or I'd get that error after running adding the Webpart and then calling ExecuteQuery().

Not sure if this helps you or anyone else.

  • You definitly need to check the page out. I had the Error too. Please mark this as answer.
    – Markus S
    Dec 4, 2015 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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