Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
Sharepoint: busque en una lista grande con CAML Query

Tengo una lista de SharePoint (list_dls) que tiene todas las direcciones de correo electrónico. La lista tiene una sola columna con el nombre de campo "Título". Necesito validar que el elemento en "LookupField" esté contenido en 'list_dls'. La lista tiene más de 5000 correos electrónicos, por lo que tendré que hacer una consulta CAML. El script no parece encontrar el elemento. Cualquier idea para hacerlo funcionar sería muy apreciada.

Aquí está el código.

 <input type='button' value='get Lists' onclick="PopulateLookupField();"/> <p id="demo"></p> <script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script language="javascript" type="text/javascript"> var LookupField = 'lnam@xyz.com'; function PopulateLookupField() { var clientContext = new SP.ClientContext.get_current(); var LookupList = clientContext.get_web().get_lists().getByTitle('list_dls'); var camlQuery_list = new SP.CamlQuery(); camlQuery_list.ViewXml = @"<View Scope='RecursiveAll'><ViewFields><FieldRef Name='ID'/><FieldRef Name='Title'/></ViewFields><RowLimit Paged='TRUE'>5000</RowLimit></View>"; LookupList<ListItem> allListItems = new LookupList<ListItem>(); do { var listItemCollection = LookupList.GetItems(camlQuery_list); clientContext.Load(listItemCollection); clientContext.ExecuteQuery(); allListItems.AddRange(listItemCollection); var ItemFound = listItemCollection.Where(item => item.FieldValues["Title"].ToString().Contains(LookupField); if(ItemFound !== null){break;} camlQuery_list.ListItemCollectionPosition = listItemCollection.ListItemCollectionPosition; } while (camlQuery_list.ListItemCollectionPosition != null); clientContext.load(ItemFound); alert("ItemFound = " + ItemFound); } </script>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Primero, vaya a la lista de SharePoint "list_dls" y cree un nuevo índice para la columna Título (tal vez ya esté hecho)

https://support.microsoft.com/en-us/office/add-an-index-to-a-list-or-library-column-f3f00554-b7dc-44d1-a2ed-d477eac463b0

Además, puede buscar inmediatamente con caml query en una lista

 camlQuery_list.ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>{LookupField}</Value></Eq></Where></Query></View>"; ListItemCollection collection = LookupList.GetItems(camlQuery_list); context.Load(collection); context.ExecuteQuery(); if (collection.Count > 0) { var yourItem = collection[0]; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!