5

I am working on a PowerShell Script that connects to the CoreService in 2013 GA

My script encounters the following error. I have checked all over and found many pointers to solutions but, so far none of them are solving this for me. Anyone encounter this before and successfully resolve the issue?

Exception calling "GetList" with "2" argument(s): "The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.sdltridion.com/ContentManager/CoreService/2012:GetListResult.

The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '.

In my CoreService Client's configuration I have added the following to the Endpoint:

behaviorConfiguration="ClientBehavior"

To the same Config file I have added the following

<endpointBehaviors> 
  <behavior name="ClientBehavior"> 
    <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
  </behavior> 
</endpointBehaviors
  • 1
    stackoverflow.com/questions/2325321/… - the selected answer shows that the work around was to use code to set up the connection. have you tried connecting this way? – johnwinter Dec 11 '13 at 20:43
  • I haven't tried this route yet. I will venture down this path and see if I can insert this logic. – Tory Johnson Dec 11 '13 at 20:53
  • @ToryJohnson I've edited your question to try and make it more readable, please see the FAQ section on how to properly use code blocks (by intending code with four spaces) allowing you to use < and > so you don't have to omit them. Can you review my changes and edit where needed to keep the info correct? – Bart Koopman Dec 12 '13 at 9:02
  • Also, have a look at the open source Tridion PowerShell Modules project - it connects to 2013 SP1 too. If you have any additions, I'm open to them! The URL is code.google.com/p/tridion-powershell-modules – Peter Kjaer Dec 17 '13 at 11:44
1

You say, "In my CoreService Client's configuration I have added the following to the Endpoint...", yet you also state that you are using the PowerShell. To use a configuration file with a PowerShell script, you would need to create a configuration file for the PowerShell executable itself. We mostly choose not to do this, and to do the configuration in the script itself.

To modify this property in code, I suspect you would rapidly find yourself armpit-deep in the quicksand of the WCF. While it is presumably possible, you may find it a better use of your time to avoid the problem in a different way.

You have encountered this issue while getting a list from the core service, but you have not described which list or how you have filtered it. I would suggest composing your query in a different way, so that the number of items in the result set is reduced. For example, you might limit your results to a specific publication, or to a smaller container.

To see an example of how you can recurse the entire Tridion tree if necessary, making use of multiple queries, you can refer to this recipe in the Tridion Cookbook. It's brute force, but it will get you there.

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.