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

Similar Messages

  • CAML query in Workflow inside sharepoint hosted app

    Hi,
    I am building a sharepoint hosted app for sharepoint online.The app includes a list workflow.One of the activity in the workflow is to query another list within the app web, to get count of items where a condition is met.Can anyone please guide me how this
    can be achieved?
    Thanks!

    Hello Steve,
    Thanks for the Reply
    Following code helped me in creating the Subsite successfully in host web
    Var hostWebUrl;
    Var appWebUrl;
    Var context;
    Var newSubsite;
    function () {
    try
    hostWebUrl = GetQueryString("SPHostUrl");
    appWebUrl = GetQueryString ("SPAppWebUrl");
    var layoutsRoot = hostWebUrl +
    '/_layouts/15/';
    $.getScript(layoutsRoot + "SP.Runtime.js",
    function () {
    $.getScript(layoutsRoot + "SP.js", CreateSubsite);});
    catch(ex)
    alert("message" + ex.message);
    function GetQueryString (name) {
    name = name.replace(/[\[]/,
    "\\\[").replace(/[\]]/,
    var regex =
    new RegExp("[\\?&]"
    + name + "=([^&#]*)"),
    results = regex.exec(location.search);
    return results ==
    null ?
    "" : decodeURIComponent(results[1].replace(/\+/g,
    // Function to create subsite
    function CreateSubsite () {
    context = new SP.ClientContext(appWebUrl);
    var hostContext =
    new SP.AppContextSite(context, hostWebUrl);
    var webCreateInfo =
    new SP.WebCreationInformation();
    //set values
    webCreateInfo.set_description("New Subsite Created");
    webCreateInfo.set_language(1033);
    webCreateInfo.set_title("NewSubSite");
    webCreateInfo.set_url("SubsiteURL");
    webCreateInfo.set_useSamePermissionsAsParentSite(true);
    webCreateInfo.set_webTemplate("STS#0");
     this.web = hostContext.get_web();
    newSubsite = this.web.get_webs().add(webCreateInfo);
    context.load(newSubsite);
    context.executeQueryAsync(
    Function.createDelegate(this,successHandler),Function.createDelegate(this,errorHandler));
    function successHandler() {
    alert("subsite created successfully");
    function errorHandler(sender, args) {
    alert("Could not complete cross-domain call: " + args.get_message());
    Vishnu

  • 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.

  • How to filter a sharepoint list with report parameters

    Hello there,
    I'm trying to make a sql report on a sharepoint library. I have no problems to connect to the library but i cannot find a way to filter my data source with report parameters. I've searched on the net a lot, found some stuffs about xml but nothing that shows
    how to do it with sharepoint. Any help would be greatly appreciated!
    Thanks in advance!

    Hi mgarant,
    As you mentioned, by default, we can use xml parameter "query" to filter a SharePoint list from SQL Server Reporting Services. We can also modify the value for the "query" to use SQL Server Reporting Serivces parameters to filter the SharePoint list.
    Below are the detailed steps for your reference:
     1.Change the query string to be a string like this:
    <Query>
    <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
    <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
    <Parameters>
    <Parameter Name="listName">
    <DefaultValue>{ADBE55DB-63A1-4C14-9DA0-B1B05C13B4C8}</DefaultValue>
    </Parameter>
    <Parameter Name="query" Type="xml">
    </Parameter>
    </Parameters>
    </Method>
    <ElementPath IgnoreNamespaces="true">*</ElementPath>
    </Query>
     2.In the dataset modification dialog, go to "Parameters" tab.
     3.Create a Report Parameter(e.g. CityParam).
     4.In parameter tab, create a parameter with:
    Name: query
    Value: ="<Query>
       <Where>
          <Eq>
             <FieldRef Name='WorkCity' />
             <Value Type='Text'>" & Parameters!CityParam.Value & "</Value>
          </Eq>
       </Where>
    </Query>"
    Please note, “case sensitive” is required. In this case, the parameter name for "query" must be in lower case. WorkCity is name of a field in the SharePoint list.
    For more information about how to retrieve value from SharePoint list, I would suggest you reading the following article and threads:
    http://vspug.com/dwise/2007/11/28/connecting-sql-reporting-services-to-a-sharepoint-list-redux/
    http://blogs.msdn.com/mariae/archive/2007/12/13/querying-sharepoint-list-from-reporting-services-returns-only-not-null-columns.aspx
    I also implemented a sample, you could download it from:
    http://cid-3c7e963ff6ccd974.office.live.com/browse.aspx/.Public/SharePoint%20List%20sample?uc=2
    Please feel free to ask, if you have any more questions.
    Thanks,
    Jin Chen
    Jin Chen - MSFT

  • 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

  • CAML Query Benchmark

    CAML query performance benchmark
    Hi All,
    My company has recently moved to MS technology and our portal has been developed using .Net and SharePoint 2010 to replace our old system that is based on Oracle 11g and Oracle forms.
    The main observation that we have is that CAML queries are much slower than their equivalent Oracle query or even a direct SQL (just for testing).
    To investigate CAML query performance we choose a list of CAML queries that we execute in our portal and (just for testing) wrote the equivalent direct SQL statements and tried both in similar network conditions to discover that CAML is at least 10 times
    slower than the direct SQL!
    We are suspecting that our CAML queries are not efficient (especially when join is needed) but some sample queries are direct selects with the same ration 10:1!
    We need an expert advice to know whether this is the normal benchmark and what to do about it:
    move part of the schema to a relational database (SQL or Oracle)
    replace the CAML with SharePoint Library Query
    replace the CAML with direct SQL (I read several articles about how this is considered a taboo but the current performance is not acceptable at all especially when there is a system that works with older technology that is performing much
    faster)
    One of the examples:
    CAML:
    <Where><Contains><FieldRef Name="ECM_F_BarcodeNo" /><Value Type="Text">-01-</Value></Contains></Where>
    SQL:
    Select *
    From UserData
    As Doc where
    Doc.nvarchar10
    like '%-01-%'
    Many thanks

    Hi,
    Please check those links 
    http://charliedigital.com/2013/12/05/a-simple-way-to-improve-caml-query-performance/
    http://apmblog.compuware.com/2010/03/18/how-to-avoid-the-top-5-sharepoint-performance-mistakes/
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/909b8855-efea-4ee9-b63a-d021b3d416a7/sharepoint-2010-caml-query-performance-list-layout-and-design
    http://sharepoint.stackexchange.com/questions/43885/caml-vs-linq-vs-sql
    Tool to generate CAML queries
    https://spcamlqueryhelper.codeplex.com/
    https://camlex.codeplex.com/
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • CAML query to get itemcount from sharepoint list based on Month/Year

    Hi,
     I have a SharePoint list with date field. Now I wan't to get item count for each month in Fiscal Year using SP Services. Hence, need a CAML query to get item count . Any suggestions will be appreciated.
    Thanks in Advance.

    When you have your month, you'll need to calculate the first day and last day of the month and convert them to the ISO using to ISOString.
    startDate.toISOString();
    endDate.toISOString();
    function searchList(startDate, endDate) {
        var nURL = "/_vti_bin/lists.asmx";
        var soapEnv = "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
                                 <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
                                  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
                                  xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
                                  <soap:Body> \
                                  <GetListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">
                                  <listName>{YourList}</listName> \
                                  <viewFields></viewFields> \
                                  <query><Query><Where><And><Geq><FieldRef Name='DateField'
    /><Value Type='DateTime'>" + startDate +"</Value></Geq><Leq><FieldRef Name='DateField'><Value Type='Datetime'>"+endDate+"</Leq></And></Where></Query></query> \
                                  <queryOptions><QueryOptions><ViewAttributes Scope='Recursive'/></QueryOptions></queryOptions>
                                  </GetListItems> \
                                      </soap:Body> \
                                  </soap:Envelope>";
        $.ajax({
            url: nURL,
            beforeSend: function(xhr) {
                xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResults,
            contentType: "text/xml; charset=utf-8"
    function processResults(xData, status)
      var i;
       result = $(xData.responseText).find("z\\:row, row");
        if (result == undefined) {
            result = $(xData.responseXML).find("z\\:row, row");
        $(result).each(function(i, data) {
        //Magic   
          i++; 
        return i;
    Brandon James SharePoint Developer/Administrator

  • 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

  • Filter SharePoint list items using CAML query as same as Like operator in SQL Server.

    Hi ,
    I have filtered SharePoint list items based on Name using CAML query <Contains> . Now I have a new requirement is to filter list items using Like operator in SQL. But Like operator is not in CAML.
    How do I filter list items using CAML as same as Like operator in SQL.
    Please let me know.
    Thanks in Advance.

    Did you try using <Contains>?
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/15766fd5-50d5-4884-82a1-29a1d5e38610/caml-query-like-operator?forum=sharepointdevelopmentlegacy
    --Cheers

  • CAML Query to Sort SharePoint list items based on Modified date

    hi ,
    can we sort sharePoint list items based on 'Modified' column, the sorting should be done up to milliseconds level.
    currently i am using CAML query as below
    <OrderBy><FieldRef Name='Modified' Type='DateTime' IncludeTimeValue='TRUE' Ascending='False'/></OrderBy>but its not considering milliseconds while sorting.
    Thanks and Regards,
    venkatesh.

    Veda, thanks but I'm not really a hardcore C# coder.
    We found more elegant solution was to create a List View which returns all records that should be deleted, based on our own custom deletion criteria, and then create an very simple SSIS Package in Visual Studio using the
    Sharepoint Connectors for SSIS to delete all Sharepoint List Items returned from that List View. The Sharepoint Destination Connector has a delete operation.
    This worked for us and didn't require any coding.

  • Query SharePoint List View

    As per http://msdn.microsoft.com/en-us/library/ms434064.aspx if we use
    list.GetItems(query, view.ID.ToString("B").ToUpper());
    properties of the view that is specified by the viewName parameter override the properties that are specified in the query object that is passed through the query parameter. For example, if the query
    object includes a tag that specifies only items containing a particular column value, while the view specifies to return all items, this method retrieves all of the items
    So is there any way to query a sharepoint list view (not All Items) using CAML query?
    I this retrieving view in a data table and query it later, which is an option but might give a performance degradation.
    Regards, Aj (http://www.aj-sharepoint.blogspot.com/) MCTS

    Hello,
    Did you try with SPView.Query method? If not then this can be query to specific view.
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spview.query.aspx
    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

  • How do I query a SharePoint List using a url and filtering on date?

    I am reading a SharePoint list using jquery.  Everything is working fine
    except for the filter.  Each list item has an expiration date.  I want to retrieve JUST the items that have not expired (Expires > Today) but I can't figure out the url syntax and I've been searching all day for an example and
    can't find one.  Could someone please help?!?  See bold code below.
    Thanks,
    Glen
    $(document).ready(function ()
    <strong>var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
    </strong> $.getJSON(qryWCFUrl, function (results)
    $.each(results.d.results, function (i, mmAlert)
    itemID = mmAlert.Id;
    mmTitle = mmAlert.Title;
    mmClass = mmAlert.ClassValue;
    //alert("Item="+itemID+" Title="+mmTitle+" Class="+mmClass);
    AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);

    Fadi,
    Thanks for your response.  I actually have another version of the code that uses the SP client objects that works.  The problem is site boundries.  Let me give a more complete project explanation.
    I am creating a master page for a new intranet.  As part of this master page, I want to read from an SP list of alerts and post each alert (if not expired) in the SP status bar.  I've gotten this to work with SP client objects and jquery (except
    for the date filter part).  Both of these solutions work fine on the top site level.  BUT when trying it out at the sub-site level, the SP client objects version of my code fails. The jQuery version works except the date filtering.
    I looked at the example from your link and it looks like a bit of a hybrid to my approaches:  JQuery with CAML.  My question is; does this example permit me to access a list in the top-level site from the subsites?  Please excuse my ignorance,
    but I am an EXTREME newbie in this having spent the past 8 years as a VB.Net developer and a little bit of ASP.Net.
    Below are the two different versions of my code in different versions of my master page definition:
    SP Client Object Version
    <script type="text/javascript">
    // <![CDATA[
    ExecuteOrDelayUntilScriptLoaded(LoadAlerts, "sp.js");
    var ctx;
    var currAlerts;
    function LoadAlerts() {
    ctx = new SP.ClientContext.get_current();
    list = ctx.get_web().get_lists('/sites/MMTP1/Lists/').getByTitle('MMAlerts');
    var cmlQry = new SP.CamlQuery();
    var camlExp = '<query><Query><Where><Gt><FieldRef Name="Expires" /><Value IncludeTimeValue="FALSE" Type="DateTime"><Today /></Value></Gt></Where></Query></query>';
    cmlQry.set_viewXml(camlExp);
    currAlerts = list.getItems(cmlQry);
    ctx.load(currAlerts,'Include(ID,Title,Class)');
    ctx.executeQueryAsync(GetAlertsSuccess,GetAlertsFailed);
    function GetAlertsSuccess() {
    var lstEnum = currAlerts.getEnumerator();
    while(lstEnum.moveNext()) {
    var mmAlert = lstEnum.get_current();
    AddMMStatus(mmAlert.get_item('ID'),mmAlert.get_item('Title'),mmAlert.get_item('Class'));
    function GetAlertsFailed(sender,args) {
    alert('Alerts load failed: ' + args.tostring);
    function AddMMStatus(msgID, strTitle, strClass) {
    var statID;
    var statClass;
    var statTitle;
    statClass = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a>";
    statTitle = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a>";
    statID = SP.UI.Status.addStatus(statClass, statTitle, true);
    SP.UI.Status.setStatusPriColor(statID,"red");
    function DisplayAlert(msgID) {
    var options = {
    title: "Miller & Martin Alert!",
    url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
    allowMaximize: false,
    showClose: true
    SP.UI.ModalDialog.showModalDialog(options);
    // ]]>
    </script>
    JQuery Version (works except for filtering by date)
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" >
    // <![CDATA[
    var itemID;
    var mmTitle;
    var mmClass;
    $(document).ready(function ()
    var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
    $.getJSON(qryWCFUrl, function (results)
    $.each(results.d.results, function (i, mmAlert)
    itemID = mmAlert.Id;
    mmTitle = mmAlert.Title;
    mmClass = mmAlert.ClassValue;
    AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);
    function AddMMStatus(msgID, strTitle, strClass, strSeverity) {
    var statID;
    var statClass;
    var statTitle;
    statClass = "<div id=\"mmAlertTitle\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a></div>";
    statTitle = "<div id=\"mmAlertDetail\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a></div>";
    statID = SP.UI.Status.addStatus(statClass, statTitle, true);
    SP.UI.Status.setStatusPriColor(statID,"green");
    function DisplayAlert(msgID) {
    var options = {
    title: "Miller & Martin Alert!",
    url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
    allowMaximize: false,
    showClose: true
    SP.UI.ModalDialog.showModalDialog(options);
    // ]]>
    </script>

  • Caml query to check current logged in user - SharePoint designer

    Hi,
    I need to create a caml query in SharePoint designer to satisfy the below conditions.
    If the logged in user (current user) is a member of a specific group. e.g. Group Name = ISS Owners, ID=5
    (OR)
    If the logged in user (current user) exists in assigned to field. e.g. Field Name = Assigned To
    Reference to the below link is not working for my solutions.
    Membership Element (Query)
    CAML Query – Membership attribute
    Kindly help in resolving caml query issue.
    Anandhan.S Remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

    The second condition is pretty straightforward
    <Eq>
    <FieldRef Name="AssignedTo"/>
    <Value Type="Integer">
    <UserID />
    </Value>
    </Eq>
    but I don't think you can do the former. The <Membership> condition can only be applied to a <FieldRef>, not a generic <Value> argument.
    But what would be the purpose of the first condition in the first place? It's invariant, not related to specific list items. Or is the requirement to return all items if the user is a member of a group (Administrators?), but only assigned-To items if not:
    If so, is there some way you can refactor the check for the former condition into some higher level logic? 

  • 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

  • GetListItems CAML query using Lookup fields

    Hi,
    I am struggling to find the correct CAML query syntax to use for GetListItems where I need to return an item ID based on a query involving both a lookup field (lookup is to a column within the same list) and a text field.
    For Example (but changing one of the below to a lookup field):-
    <soap:Body>
        <m:GetListItems>
          <m:listName>ListName</m:listName>
          <m:query>
    <Query>
      <Where>
        <And>
          <Eq>
            <FieldRef Name="LevelOne" />
            <Value Type="Text">"test1"</Value>
          </Eq>
          <Eq>
            <FieldRef Name="LevelTwo' />
            <Value Type="Text">"test2"</Value>
          </Eq>
        </And>
      </Where>
    </Query>
    </m:query>
    <m:viewFields>
    <FieldRef Name ="ID" />
    </ViewFields>
    </m:viewFields>
    </m:GetListItems>
    </soap:Body>
    Any help appreciated!

    When you query a lookup column, you can choose to either query by text value or by lookup ID number (that is, the ID of the item being looked up).
    Here are examples of both:
    <FieldRef Name="MyLookupColumn" />
    <Value Type="Lookup">Thriggle</Value>
    <FieldRef Name="MyLookupColumn" LookupId="TRUE" />
    <Value Type="Lookup">100</Value>

Maybe you are looking for

  • Runtime Enviroment error

    I tried to load the runtime enviroment program and kept getting an fatal plug in error message, please tell me how to fix this problem.

  • Reconnecting Offline Images in Ap3

    I use Ap 3 and store my files on a gdrive (not in the aperture library) . Some images are not viewable and when in the browser mode they appear as an empty box with a dotted frames around where the image should be. So I go to locate referenced files

  • Can I use the music on my iphone to copy music I've purchased back to itunes?

    We have recently had a virus on our pc, we have had to replace the hard drive as everything had been corrupted, We have lost all music including all purchased ITunes songs and I would like to know if there is anyway of putting it onto our new hard dr

  • Command For Authorization Check

    Hii...Dudes... Can Any one tell me..What are the Commands and Procedure to do Authorization Check for Programs.. Any documentation could be help ful... Tell me How to create ....an Z Object and tell me procedure too... points will be rewarded .......

  • HELP! - An iPad can be synced with only one iTunes library at a time....

    I had to reinstall Windows 7. After that I reinstalled iTunes. I went to sync my iPad and it says "An iPad can be synced with only one iTunes library at a time. What would you like to do". I really don't want to lose ANYTHING on my iPad. Please tell