Search code examples
sharepointsoapsharepoint-2010

Sharepoint Querying a list with paging


I'm using SOAP UI to query the Sharepoint List. Here is my **updated ** SOAP Request:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItems>
         <!--Optional:-->
         <soap:listName>Example</soap:listName>
         <!--Optional:-->
         <soap:viewName>{AAAAA-AAAA-AAA-AAAAA}</soap:viewName>
         <!--Optional:-->
         <soap:query>
            <Query>
            </Query>
         </soap:query>
         <!--Optional:-->
         <soap:viewFields>
            <ViewFields>
                <FieldRef Name="Author" />
                    <FieldRef Name="ContentType" />
                    <FieldRef Name="ContentTypeId" />
            </ViewFields>
         </soap:viewFields>
         <!--Optional:-->
         <soap:rowLimit>1000</soap:rowLimit>
         <!--Optional:-->
         <soap:queryOptions>
            <QueryOptions>
                   <ViewAttributes Scope="RecursiveAll"/>
            </QueryOptions>
         </soap:queryOptions>
         <!--Optional:-->
         <soap:webID></soap:webID>
      </soap:GetListItems>
   </soapenv:Body>
</soapenv:Envelope>

I get the below error when I run this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
         <detail>
            <errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by the administrator.Operations that exceed the list view threshold are allowed in the following time window defined by the administrator: &lt;br/>&lt;b>Daily, from  7:00:00 PM to 11:00:00 PM . &lt;/b></errorstring>
            <errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x80070093</errorcode>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

I can access the List during the hours mentioned in the error but is there any way through pagination or something else that will allow to access this list during outside of these hours? Thank you for any help.


Solution

  • That error is complaining not about the number of results but about the number of lookup columns displayed in the view.

    When you include lookup columns in your CAML query, SharePoint has to do some extra work behind the scenes to query the related lists and pull in the relevant information. This can impact database performance, so SharePoint puts a default limit of 8 lookup columns on each query during business hours. (In SharePoint 2013 this is expanded to 12.) For more details, see this Microsoft blog post.

    Note that as far as the threshold is concerned "lookup columns" includes columns of type Lookup and Person or Group, as well as Workflow Status columns.

    To perform your query during business hours, you can remove columns from your view until the view no longer shows more than 8 lookup columns.