Javascript Caml Query join error

Greetings, i'm getting an error in a caml query. I have 3 lists: Reuniones, Tareas, Gerencias. Tareas has a lookup to Reuniones (by ID) and Reuniones has a lookup to Gerencias (by Title). I'm trying to get all items in Tareas pointing to a Gerencias item
"X", that is, all items in Tareas that has a Reuniones item with "X" as Gerencias lookup. Another requirement is that the Tareas item startdate has to be in a certain range.
The problem is that my query is returning " Value does not fall within the expected range."
My Query:
<View>
<Query>
<Where>
<And>
<And>
<Geq>
<FieldRef Name='StartDate'></FieldRef><Value Type='DateTime'
IncludeTimeValue='TRUE' StorageTZ='TRUE'>2014-02-01T02:00:00.000Z</Value>
</Geq>
<Leq>
<FieldRef Name='StartDate'></FieldRef><Value Type='DateTime' IncludeTimeValue='TRUE' StorageTZ='TRUE'>2014-03-01T02:00:00.000Z</Value>
</Leq>
</And>
<Eq>
<FieldRef Name="Gerencia" List="Reuniones"/>
<Value Type="Lookup">GerenciaExample</Value>
</Eq>
</And>
</Where>
</Query>
<ViewFields>
<FieldRef Name="Reunion" />
<FieldRef Name="StartDate" />
<FieldRef Name="Status" />
</ViewFields>
<ProjectedFields>
<Field Name="Gerencia" Type="Lookup" List="Reuniones" ShowField="Gerencia" />
</ProjectedFields>
<Joins>
<Join Type="Left" ListAlias="Reuniones">
<Eq>
<FieldRef Name="Reunion" RefType="Id" />
<FieldRef List="Reuniones" Name="ID" />
</Eq>
</Join>
</Joins>
</View>

Hi,
Based on the error message, we can increase the value of the List View Lookup Threshold. 
Go to the Central Admin > Application Management
> Manage web applications>General Settings
> Resource Throttling
Here is a tool for you to check the query syntax.
http://www.codeproject.com/Articles/458008/CAML-Query-Builder
More information:
List Join in SharePoint 2010 using CAML
http://sujeewaediriweera.wordpress.com/2012/02/18/list-join-in-sharepoint-2010-using-caml/
Best Regards
Dennis Guo
TechNet Community Support

Similar Messages

  • Problem with caml query in javascript

    hi friends
    i am using caml query to retrieve single list item
    ReviewQuery.set_viewXml('<view><query><Where><Eq><FieldRef Name=\'PNet_x002d_No\' /><Value Type=\'Text\'>'+id123+'</Value></Eq></Where></query></view>');
    my problem is if quried id is available in list it is showing properly. but if queried item is not there then it is showing other item in it.

    Hi,
    I suggest you debug the code and check if the variable value is valid.
    Here is a code snippet for your reference :
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("callCSOM");
    function callCSOM()
    $("#Button1").click(function()
    // Make sure the SharePoint script file 'sp.js' is loaded before your code runs.
    ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");
    function sharePointReady()
    getListItems();
    var clientContext;
    var currentUser;
    var targetWeb;
    var message = "Web retrieved:";
    function getListItems()
    // Create an instance of the current context to return context information
    clientContext = SP.ClientContext.get_current();
    //Returns the list with the specified title from the collection
    var oList = clientContext.get_web().get_lists().getByTitle('list');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(‘<ViewFields><FieldRef Name='Title' /></ViewFields><Where> <Eq><FieldRef Name='Title' /><Value Type='Text'>12</Value></Eq> </Where>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
    function onRequestSucceeded()
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    //Gets the current element in the collection
    var oListItem = listItemEnumerator.get_current();
    message += '___'+'Title: ' + oListItem.get_item('Title');
    message += '___'+'ID: ' + oListItem.get_item('ID');
    message += '________________________________________________';
    $("#div1").text(message);
    //the delegate of the method that is called when the request is executed unsuccessfully
    function onRequestFailed(sender, args)
    alert('Error: ' + args.get_message());
    </script>
    <input id="Button1" type="button" value="Run Code"/>
    <p/>
    <div id="div1">test</div>
    Also, you can build CAML Query in the CAML Designer:
    http://www.camldesigner.com/
    Feel free to reply if the issue still exists.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Join two list with condition using caml query in SharePoint 2013 with client object model

    Hi,
    Want to join two list to get all fields from both list.
    Am new to sharepoint and sharepoint 2013. Am working in sharepoint 2013 online apps. Am using context.executeQueryasync to load list and get items from list. Am able to get items from single list with caml query, but not able to get both list field values
    with joins.  I did lot of surfing..but not..
    Below is my code..
    ListName1 : "AssignedTasks"
    ListName2 : "Tasks"
     var assignedQueryTest = "<View><Joins><Join Type='INNER' ListAlias='Tasks'><Eq><FieldRef Name='TaskId' RefType='Id'/><FieldRef List='Tasks' Name='ID' /></Eq></Join></Joins>"
                    + "<ViewFields><FieldRef Name='TitleValue' /><FieldRef Name='ActionItemsValue' /></ViewFields>"
                    + "<ProjectedFields>"
                    + "<Field Name='TitleValue' Type='Lookup' List='Tasks' ShowField='Title' /><Field Name='ActionItemsValue' Type='Lookup' List='Tasks' ShowField='ActionItems' />"
                    + "</ProjectedFields>"
                    + "</View>";
                   var web = context.get_web();
                    var list = web.get_lists().getByTitle("AssingedTasks");
                    var myQuery = new SP.CamlQuery();
                    myQuery.set_viewXml(assignedQueryTest);
                    var myItems = list.getItems(myQuery, "Include(TitleValue,ActionItemsValue)");
                    context.load(myItems);
                    context.executeQueryAsync(function () { if(myItems.get_count()>0){....}
    }, errorCallback);
    Here am able to get "AssignedTasks" list field values but not able to get "Tasks" list field values. 
    Can you please help me to resolve the issue. Or new idea for join. I have add the condition also in the query.
    If anybody have good sample, please provide.
    Thanks,
    Pariventhan
    Pariventhan.S

    Hi Pariventhan,
    I don't know about join but I have a workaround of this problem.
    Declare one variable (itemcollection) globally. Load all the items "AssignedTasks" using context.load.
    In the success method call another CAML query using <IN> tag of the ID of the items from the second list (Assuming you have look-up column of the ID of the first list to the second list).
    If this is not clear to you then please let me know. If possible then I can provide code sample.
    Thanks,
    Aniruddha

  • Join two list of integer type field using CAML query

    Hi
    As i am struggling in Join two sharepoint list (Roles and Emplyees). As there is no lookup columns and lists are already existing and have almost 3000 + recodrs. As a part of enhancement work need to join these list. List structure is some thing as follows: 
    Roles :
    ID                              Title
    1                               Project Manager
    2                               Business Analyst
    3                              Developer
    Employees :
    Name                       Role
    1 James                  1
    2 Petar                    3
    3 John                     2
    Output should be like as follows:
    Name                       Role
    1 James                  Project Manager
    2 Petar                    Developer
    3 John                     Developer
    So please suggest, if the joining can be done other than lookup columns through the CAML query.
    Akhilesh Rao

    Follow below CAML query to add joins between two lists.
    SPList list = SPContext.Current.Site.RootWeb.Lists["Employees"];
    SPQuery query = new SPQuery();
    query.Joins = @" <Join Type="INNER" ListAlias="Roles">
    <Eq>
    <FieldRef Name="Employees" RefType="Role" />
    <FieldRef List="Roles" Name="ID" />
    </Eq>
    </Join>";
    query.ProjectedFields = @" <Field Name="RoleName" Type="Lookup" List="Roles" ShowField="Title">";
    query.ViewFields = @ "<FieldRef Name="Title">
    <FieldRef Name="RoleName"> ";
    SPListItemCollection result = tablea.GetItems(query);
    Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer :)

  • CAML query to get Published items in javascript client object

    Hi,
    I am using the Javascript client object model.
    I am trying to use the CAML query to fetch the Published items. (excluding checked-in but not published) .
    I have tried the below code, but I am not able to get the published items alone. I am getting the checked-in but not published items as well.
    function FetchPages() {
    var clientcontext = new SP.ClientContext.get_current();
    var oweb = clientcontext.get_web();
    var olist = oweb.get_lists().getByTitle("Pages");
    var query = new SP.CamlQuery();
    query.ViewXml = "<Where>
    <Eq><FieldRef Name=\"_Level\" /><Value Type=\"Integer\">1</Value></Eq></Where>";
    query.set_viewXml();
    pagesItems = olist.getItems(query);
    clientcontext.load(NewsItems, 'Include(Title,FileLeafRef,FileDirRef)');
    clientcontext.executeQueryAsync(Function.createDelegate(this, this.RenderHtmlOnSuccess), Function.createDelegate(this, this.RenderHtmlOnFailure));
    function RenderHtmlOnSuccess() {
    var enumerator = this.pagesItems.getEnumerator();
    while (enumerator.moveNext()) {
    var currentItem = enumerator.get_current();
    I am getting items which are published as well as items which are checked-in but not published.
    Update: I have tried this query, but the same result:
    <FieldRef Name='_ModerationStatus' /><Value Type='ModStat'>0</Value></Eq>
    How to fix this?
    Also, I checked this:
    http://mysharepointwork.blogspot.com/2011/03/get-published-version-of-list-item.html
    for (int index = 0; index < item.Versions.Count; index++)
    if (item.Versions[index].Level == SPFileLevel.Published)
    // Got the Item
    How to modify the above code for Javascript client object model?
    Thanks

    Hi,
    Please try to modify the query statement as below and do the test again, it works in my environment:
    var query = new SP.CamlQuery();
    query.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'_Level\'/><Value Type=\'Integer\'>1</Value></Eq></Where></Query></View>');
    pagesItems = olist.getItems(query);
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • CAML Query with Javascript value

    Hey everyone,
    I am building an Sharepoint 2013 app (SharePoint-Hosted) and using a CAML Query to get the current Item.
    The Current Item ID is 1 and i stored it in AccountID, but i want that variable inserted in the CAML Query so i get the proper information.
    var AccountID = 1
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">1</Value></Eq></Where></Query></View>');
    But instead of putting the '1' value in the CAML Query, i want the variable AccountID in it... but how?
    Already tried this, but that didn't work:
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">' + AccountID + '</Value></Eq></Where></Query></View>');
    Can someone help me with this?
    In forward, many thanks!

    Right, you have to use single quotes in a string literal inside double quotes. Just making sure it didn't have NO quotes, as your initial post showed.
    Is the ID field actually a lookup field? Or is it just the built-in ID field of the list? If it isn't a field of TYPE Lookup, try this:
    camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + AccountID + "</Value></Eq></Where></Query></View>");
    Danny Jessee
    MCPD - SharePoint Developer 2010
    MCTS - SharePoint 2010, Configuring
    dannyjessee.com/blog

  • Sum and group by using CAML query

    Is there any way to get the SUM of values with group by ID using CAML query?
    I have a custom list, in that I have ID and Value columns as below
          ID         Value1      Value2
          1             10             4
          2              5              3
          1             15             2
          3             20             1
    I want to get result:
         ID          Value1        Value2
         1             25                6
         2             5                  3
         3             20                1
    I used CAML query:
    <View>
    <Query>
    <Where>
    <IsNotNull>
    <FieldRef Name="ID" />
    </IsNotNull>
    </Where>
    <GroupBy Collapse="FALSE">
    <FieldRef Name="ID" />
    </GroupBy>
    </Query>
    <ViewFields>
    </ViewFields>
    <Aggregations Value="On">
    <FieldRef Name="Value1" Type="SUM" />
    <FieldRef Name="Value2" Type="SUM" />
    </Aggregations>
    </View>
    But
    this query returns all the records
    that satisfy the condition <Where>.
    I
    do not correctly?

    You need to work with current view based aggregation. Please check below threads for your reference.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/dda5735a-fecf-403f-9495-1b63617d2fbf/question-on-a-caml-query?forum=sharepointdevelopmentlegacy
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/24e88d6a-ee15-4d81-a5fe-504c7bd14e46/how-to-sum-a-column-value-using-caml-query?forum=sharepointdevelopment
    Hope this helps.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
    I've seen these
    issues and articles and do them, but
    does not work. I use object mozhel
    Sharepoint (javascript).

  • Value does not fall within the expected range while passing a spfieldlookupvalue in a caml QUERY

    i have to pass a column from master list -single line of text - and this will be the lookup of another column in another list
    splist1---> column1 [ free text]
    splist2--> column2  [ lookup column of the above list -splist1]
    now am writing a  caml query :
       objDisciNodeQuery.Query =
                                          string.Format(
                                       "<OrderBy>" +
                                         "<FieldRef Name='ID' />"
    +
                                      "</OrderBy>" +
                                       "<Where>" +
                                        "<And>" +
                                          "<Eq>" +
                                             "<FieldRef
    Name='somecolumn' />" +
                                             "<Value
    Type='Text'>{0}</Value>" +
                                          "</Eq>" +
                                          "<Eq>" +
                                             "<FieldRef
    Name='column2' LookupId='TRUE' />" +
                                             "<Value
    Type='Lookup'>{1}</Value>" +
                                          "</Eq>" +
                                         "</And>" +
                                       "</Where>", valueofsomecolumn, lookupidvalueofcolumn2);
                                        SPListItemCollection splistItemAssocCollec
    = null;
                                        splistItemAssocCollec = splist2.GetItems(objDisciNodeQuery);
    here it throws Value does not fall within the expected range
    Anyone has idea why i am getting this error, .
    any ideas  are appreciated.

    We can use lookup column in caml query link this
    <Where>
    <Eq>
    <FieldRef Name=’Departments’ LookupId=’TRUE’ />
    <Value Type=’Lookup’>10</Value>
    </Eq>
    </Where>
    Multi lookup column reference 
    http://naimmurati.wordpress.com/2013/12/03/multi-lookup-fields-in-caml-queries-eq-vs-contains/

  • CAML Query In Clause Problem

    Hi, 
    I'm using CAML query to retrieve data from custom list in SharePoint 2010 using In clause. I'm creating the <Value></Value> tag dynamically and its working fine. 
    But sometimes I get a weird, no data fetch, error. I investigated on this and get to know that CAML query In clause only allow you to add 500 <Value></Value> in <Values> tag. The moment you'll entered 501 value it will not return any
    data.
    I need to resolve this problem and I can't send fetch request to SharePoint list if someone  is of the view that I should break the clause and fetch first 500 then again 500 and so on. 
    Any help will be appreciated. 
    Thank you

    Hello Kashif,
    Can't you create extra <OR> blocks when you have more than 500 values?
    <OR>
    <OR>
    <First block 500 values>
    <Second block 500 values>
    </OR>
    <Third block rest of the values>
    </OR>
    If this is not possible, maybe you can add more of your CAML query.
    Jeroen Molenaar

  • My Library Column does not exist when I execute a Caml Query

    Hello,
    I am new to SharePoint programming.  I am trying to understand how I can access the documents in a Library Folder and obtain the field values for each document in the container.  With this in mind I have pieced together the following code from
    various posts that demonstrate how to to this:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint.Client;
    namespace ConsoleListItemsInFolder
        class Program
            static void Main(string[] args)
                ClientContext ctx = new ClientContext("http://mwp_lenovo");
                List DocumentsList = ctx.Web.Lists.GetByTitle("Claims Documents");
                CamlQuery camlQuery = new CamlQuery();
                camlQuery = new CamlQuery();
                camlQuery.ViewXml = "<View Scope=\"RecursiveAll\"> " +
                                "<Query>" +
                                "<Where>" +
                                            "<Eq>" +
                                                "<FieldRef Name=\"FileDirRef\" />" +
                                                "<Value Type=\"Text\">/Claims Documents/11111111 Stuart Little</Value>"
    +
                                             "</Eq>" +
                                "</Where>" +
                                "</Query>" +
                                "</View>"; 
                ListItemCollection listItems = DocumentsList.GetItems(camlQuery);
                ctx.Load(
                    listItems,
                    items => items
                    .Include(
                        item => item["Title"],
                        item => item["Claim Number"],
                        item => item["Policy Number"],
                        item => item["Policyholder Name"],
                        item => item["Document Type"]));
                ctx.ExecuteQuery();
                foreach (ListItem listItem in listItems)
                    Console.WriteLine("Title: {0}", listItem["Title"]);
                    Console.WriteLine("Claim NUmber: {0}", listItem["Claim Number"]);
                    Console.ReadLine();
    When I execute the code with the debugger ctx.ExecuteQuery(); throws the following error:
    Microsoft.SharePoint.Client.ServerException was unhandled
      Message=Column 'Claim Number' does not exist. It may have been deleted by another user.  /Claims Documents
      Source=Microsoft.SharePoint.Client.Runtime
      ServerErrorCode=-2147024809
      ServerErrorTypeName=System.ArgumentException
      ServerStackTrace=""
      StackTrace:
           at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
           at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
           at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
           at ConsoleListItemsInFolder.Program.Main(String[] args) in c:\Users\matt.paisley\Documents\Visual Studio 2012\Projects\ConsoleListItemsInFolder\ConsoleListItemsInFolder\Program.cs:line 37
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
    These columns do exist in the Library as verified in Library Settings.  Many of the Library column names contain two words divided by a space.  Is this causing the problem?  Does SharePoint maintain a less offensive representation of the field
    name internally?  If so, how can I get it?
    If I run this code with only the title, then it runs fine.
    I Thank All in advance for any assistance that you can provided.
    Regards,
    Matt Paisley
    Matthew Paisley

    Hello
    In addition to Geetanjali Arora answer, change also those other columns
      item => item["Claim Number"],
      item => item["Policy Number"],
     item => item["Policyholder Name"],
     item => item["Document Type"]
    If you don't know the internal name of a column,
    go to the list containing the columns
    go to "list settings"
    scoll down to the "columns" section
    click on one of your columns et take a look a the url of the new page, you should found parameter "&Field=" => What is after is your field internal name (the one you should use in your CAML query)
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • Using CAML Query in SharePoint Hosted app

    Hi,
    I am trying to execute a CAML Query in a SharePoint Hosted App, below is the JS code.
        executor.executeAsync({
            url: appwebUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('Documents')/Items?/getitems?@target='" + hostweburl + "'",
            method: "POST",
        body: { 'query' : {'__metadata': { 'type': 'SP.CamlQuery' }, "ViewXml": "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='TEXT'>value</Value></Eq></Where></Query></View>"
        headers: {
            "accept": "application/json; odata=verbose",
            "content-type": "application/json; odata=verbose"
        success: successHandler,
        error: errorHandler
    getting an error: Uncaught Error: "Invalid field or parameter requestInfo.body"

    Are you using rest api?
    Please check this
    http://tech.bool.se/using-caml-sharepoint-rest-api/
    http://msdn.microsoft.com/en-us/library/office/dn531433(v=office.15).aspx

  • CAML Query to getlistitems of sharepoint list

    hi 
    i'm having a HTML Form with Product1, product2 , product3 as checkboxes respectively.
    The user selects the product and submit the form .
    The Values of the Form are stored in sharepoint 2010 list,
    where the selected products are stored in the column called selected Products.
    if once again the user loads the HTML form , the HTML form have to be loaded with checkboxes of previously selected items
    whether it can be accompished in CAML query and spsevices javascript?
    Thanks a lot
    - David

    Hello David,
    You first need to write CAML query to fetch data from SP list based on current user login. If one user can submit only one item in list then you can simply use below query to get item from list:
    <Eq><FieldRef Name='Author'/><Value Type='Integer'><UserID Type='Integer'/></Value></Eq>
    But if you can have multiple data in list then you also need to add one more condition in query to fetch correct item from list. I have used column name called "uniqueformcolumnname" so here you need to replace your column name and also need to pass value.
    <Where>
    <And>
    <Eq>
    <FieldRef Name="Author" />
    <Value Type="Integer">
    <UserID Type='Integer'/>
    </Value>
    </Eq>
    <Eq>
    <FieldRef Name="uniquecolumnname" />
    <Value Type="Text">
    //pass unique value here
    </Value>
    </Eq>
    </And>
    </Where>
    Now once your query done then you can use below code to bind product with checkbox:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/c39495d3-3594-4eb1-86d9-882df9f48031/how-to-set-and-read-value-of-yesno-column-programmatically?forum=sharepointdevelopmentlegacy
    http://the-simple-programmer.blogspot.in/2011/01/binding-checkboxlist-object-to-ordered.html
    Let us know in case any issue
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • CAML Query to get Items based on Year and Month From Date Column

    Hi All,
           * As we knew that there are default columns in calendar like Stattdate,Title,Location..etc.
            * I required the CAML Query to get the list items of calender of particular Month and Year,So that I can get number of items or evetns are in Calendar
    Can any one help me how can I do this using caml query
    Samar

    Hi Stuart,
                 Thanks for your response,I had chosen 2nd option of our above mention suggestion.But when I try to fetech the data from a calendar it is showing below error .I
    had checked the below code with oter lists by changing Type to text and it worked fine.Can you please help me how can I fetech for the calulated columns
    Error
    "One or more field
    types are not installed properly. Go to the list settings page to delete these
    fields. "
    Code:
     string year="2014";
                string month="February";
                SPSite mysite = SPContext.Current.Site;
                SPWeb myweb = mysite.OpenWeb();
                try
                    SPList mylist = myweb.Lists["Calendar"];
                    SPQuery myquery = new SPQuery();
                    myquery.Query = @"<Where>
                                          <And>
                                           <Eq>
                                             <FieldRef Name='Year'/>
                                             <Value Type='Calculated'>"
    + year + @"</Value>
                                          </Eq>
                                          <Eq>
                                             <FieldRef Name='Month'
    />
                                             <Value Type='Calculated'>"
    + month + @"</Value>
                                          </Eq>
                                         </And>
                                      </Where>";
                    SPListItemCollection totaltiems = mylist.GetItems(myquery);
                   Label1.Text= "Total Number of Items is "+" "+totaltiems.Count.ToString();
                catch (Exception ee)
                    Label1.Text = ee.Message;
                finally
                    myweb.Dispose();
    Calculated Columns
    Samar

  • CAML query IN Clause limiation

    Hi All,
    I am trying to avoid joining the main document library list with another lookup custom list by first search the lookup custom list and get the document IDs to search them in the document library using IN clause.
    The problem with the IN clause is that it does not support more than 500 items, after than an exception is report "unable to handle search query".
    I am looking for the recommended solution for this problem.
    B.S. I have read an incomplete post "https://social.msdn.microsoft.com/Forums/sharepoint/en-US/350b2e9e-0c50-4887-85d0-b7e8bce9a3b8/caml-query-in-clause-problem?forum=sharepointdevelopmentprevious"
    that suggests dividing the IN statements into bulks of 500 items, but this did not work with me either.
    In my example:
    <Where> <In>
    <FieldRef Name="ProgId" />
    <Values>
    <Value Type='Number'>6</Value>
    -------------------more than 500 times.
    <Value Type='Number'>10006</Value>
    </Values>
    </In>
    </Where>
    Thanks,

    Hi,
    Please go through below link
    http://sharepoint.stackexchange.com/questions/80210/caml-query-limitation-of-values-in-in-operator
    Regards
    Soni K

  • CAML query on SharePoint list not working after reaching threshold limit

    I have written CAML query to filter and get list items. It was working fine, but the List items count crossed 5000 and its around 15000 items. In Server Object Model When i execute my query to get list items throws exception as " The
    attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator ".
    My Code:
    SPList list = web.Lists["ComplaintReturnsForm1"];
    string QIRIdNo = fldQIRIdNo.Text;
    SPQuery query = new SPQuery();
    query.Query = "<Where><Eq><FieldRef Name='fldQIRIdNo' /><Value Type='Text'>" + QIRIdNo + "</Value></Eq></Where>";
    SPListItemCollection itemcoll = list.GetItems(query);
    Please help me to fix it. 

    Hi Mario,
    Thanks a lot for your reply.
    query.Query = "<Where><Eq><FieldRef Name='fldQIRIdNo' /><Value Type='Text'>"
    + QIRIdNo + "
    in this CAML query i have indexed my field "fldQIRIdNo". Now i have more then 5000 items in list, and
    iam able to get my list item data without any error.
    Please let me know if my action is wrong.

Maybe you are looking for