从阈值列表中的特定视图获取项目(在线共享点)

Get items from specific View in threshold List (sharepoint online)

我在 Sharepoint Online 上有一个包含 8000 项的大列表。 (阈值为 5000)

我为此列表创建了自定义视图。 "All Items" 是第一个视图,这里从 id=1 到 id=4000,第二个视图 "All Items2" 有另一个 id (4001 - 8000)。

我创建这个视图是为了在这个大列表中搜索,但我找不到如何只在第一个视图中搜索。

当我在所有列表中 运行 caml 查询时,我得到以下异常:

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

我如何管理我的列表??谢谢

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);
            }

        }

    }

请尝试为您在 CAML 查询中使用的列编制索引(此处为标题)。 进入列表设置 在“列”下,单击 "Indexed Columns"。 单击创建新索引。 在要索引的主列 select 下,单击创建。