Forum Discussion

SunVolt's avatar
SunVolt
Copper Contributor
Dec 29, 2022
Solved

List query column lookup threshold error

Hi all, (This is for SP Online, not on-site SP)   I keep getting this error:   "The query cannot be completed because the number of lookup columns it contains exceeds the column lookup thresho...
  • SvenSieverding's avatar
    SvenSieverding
    Aug 30, 2023

    Hi SunVolt ,


    in that case i would rewrite the mapping module to take in multiple lists with different properties and merge them together in a custom object and pass that to your API. The CSOM entities are lazily loaded and I don't think that you can instantiate them manually.

    But perhaps you can get around all of that. You only seem to be loading two elements. If you only need a few items it might be easier to fetch them by ID

    List myList = context.Web.Lists.GetByTitle("Listtitle");
    
    ListItem listItem1 = myList.GetItemById(21);
    ListItem listItem2 = myList.GetItemById(25);
    
    
    context.ExecuteQuery();


    Try that. You might get arround the view limitation like that. A view and fetching an item directly behave differently.

    Best Regards,
    Sven

Resources