[Solved]: New-WebServiceProxy / GetListItems Excessive Lookup Issue

Recently, while trying to use New-WebServiceProxy to automate some SharePoint form entries, I ran into a lookup issue.

First, I got this rather generic error: Exception calling “GetListItems” with “7” argument(s): “Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thrown.” .

So I dug deeper with a try/catch.

The resulting error stated: The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by the administrator.

Upon searching Google, many people suggested increasing the threshold in Central Administration, but there were two issues with this

  1. I’m not a Farm Admin (fortunately)
  2. Marc D. Anderson pointed out some very good reasons for not increasing the threshold. The SharePoint farm I’m working with is already slow, so I wouldn’t even want to ask the Admin to up the limit.

Some folks suggested using a different view, other than the default, but even minimal views didn’t work. Ultimately, I limited the ViewFields to just the ones I needed.

This is just a snippet of the fields I used, and fortunately, the total number of fields I needed didn’t have more than 8 lookups. If your script needs to modify more than 8 lookups, then it’s likely that you’ll need to up the lookup limit or divide the Add/Update into two calls.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain RealCajunRecipes.com in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in PowerShell, SharePoint
One comment on “[Solved]: New-WebServiceProxy / GetListItems Excessive Lookup Issue
  1. sharepoint says:

    For me, the signature for GetListItems method is

    public System.Xml.Linq.XElement GetListItems(string listName, string viewName, System.Xml.Linq.XElement query, System.Xml.Linq.XElement viewFields, string rowLimit, System.Xml.Linq.XElement queryOptions, string webID)

    It use XElement, not XmlElement neither XmlNOde.

    And I get the same error Microsoft.SharePoint.SoapServer.SoapServerException about it.

Leave a Reply

Your email address will not be published. Required fields are marked *