This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


"The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by the administrator" appears when interacting with SharePoint list/document library. This exception can appear when a variety of methods are fired off in different scenarios.


The exception is not thrown by K2 but occurs when methods interacting with a SharePoint list/library are fired.

This is a SharePoint exception and appears when the number of lookups in a list/library exceeds the allotted amount. 


The solution is to remove the lookups (or to raise the SharePoint threshold which is not recommended due to performance concerns).

'People/Group' columns as well as 'Workflow Status' columns are flagged as lookups in SharePoint.

Below is a .ps1 that can be used to identify all lookup columns in the eyes of SharePoint:

#Specify the sub site where the list exists and the list title

$webUrl = "Web App URL Here"

$listTitle = "list name here"

#Get all fields that count against the lookup threshold

$web = Get-SPWeb $webUrl $list = $web.Lists[$listTitle] $list.fields | Where {($_.TypeDisplayName -eq "Person or Group" -or $_.TypeDisplayName -eq "Workflow Status" -or ($_.TypeDisplayName -eq "Lookup" -and $_.CanBeDeleted -eq $true))} | ft Title, InternalName, TypeDisplayName