0
votes

I have on sharepoint online a large list with 8000 items. (threshold is 5000)

I create a custom views for this list . "All Items" is the first view where here is from id=1 until id=4000 and second view "All Items2" where have another id's (4001 - 8000).

I create this Views for can i search in this large list but i can't find how can i search only in the first view.

When i run caml query in all list i get the following exception :

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.

How can i manage my list ?? Thanks.

void FindTest(ClientContext context, string email)
    {
        using (context)
        {
            try
            {
                Web web = context.Web;

                Microsoft.SharePoint.Client.List list = context.Web.Lists.GetByTitle("BigDataList");
                context.Load(list);
                context.ExecuteQuery();
                View view = list.Views.GetByTitle("All Items");

                context.Load(view);
                context.ExecuteQuery();
                CamlQuery query = new CamlQuery();
                query.ViewXml = @"<View>  
         <Query> 
         <Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + email + "</Value></Eq></Where></Query><ViewFields><FieldRef Name='Title' /></ViewFields></View>";


                Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(query);
                context.Load(items);
                context.ExecuteQuery();

                Console.WriteLine(view.Title);
                Console.WriteLine(items.Count);


            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }

        }

    }
1

1 Answers

1
votes

Please try to index the columns you are using in CAML query (here Title). Go the list settings Under Columns, Click on "Indexed Columns". Click on Create a new Index. Under Primary column select the column you want to index and click on Create.