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

Similar Messages

  • How to generate auto increment id for sharepoint list item using calculated column?.

    Dear all,
    List Id will be auto generated in the format “TP_W1_SCO_00001”.(00001 Numbers will keep changing for the documents).
    FOR EX:-
    first listem ID :TP_W1_SCO_00001
    sECOND listem ID :TP_W1_SCO_00002
    Please tell me how to do it by using calculated column.
    Regards
    swapna
    SWAPNA

    In this solution you have to make two additional columns and one workflow.
    step 1 :
    create column ‘pID’ on the list of the type number.
    Step 2:
    Create on the list with SharePoint Designer a listworkflow
    Set in the start option: ‘Start workflow automatically when an item is create’
    In the workflow you set de column 'pID' with the value from 'ID' ( standard column)
    Use for this the option: ‘Set field in current item’.
    You need that because you can't use the column 'ID' in the formula in an calculated column
    Step 3:
    create column ‘IssueID’ on the list of the type calculated column.
    Use the formula:
    =""&"TP_W1_SCO_"&[pID]
    /blog
    twttr @esjord

  • Unable to Read Calendar List Items through CAML

    Hi All,
    * I have created two columns in calendar one Year and other Month.When new event is added in calendar through (Item Added) event receiver I am setting the values to this columns as Name of Month to(February) and Year as(2014)  .So that I can fetch the
    data easily based on month and year
    * Through this Columns Secondly when I try to fetch the data to count number of items of particular month and year using caml query I am getting error as below .
    "Error:One or more field types are not installed properly. Go to the list settings page to delete these fields."
    *My below caml code is working fine if i applied to custom list,But not to calendar.Can any one help me for what reason I am unable to fetch data
    Code
     string year="2014";
     string month="February";
     SPSite mysite = SPContext.Current.Site;
     SPWeb myweb = mysite.OpenWeb();
    SPList mylist = myweb.Lists["Calendar"];
     SPQuery myquery = new SPQuery();
      myquery.Query = @"<Where>
                                          <And>
                                           <Eq>
                                             <FieldRef Name='Year'/>
                                             <Value Type='Text'>" + year + @"</Value>
                                          </Eq>
                                          <Eq>
                                             <FieldRef Name='Month' />
                                             <Value Type='Text'>" + month + @"</Value>
                                          </Eq>
                                         </And>
                                      </Where>";
     SPListItemCollection totaltiems = mylist.GetItems(myquery);
      Label1.Text= "Total Number of Items is "+" "+totaltiems.Count.ToString();
    Thanks, Quality Communication Provides Quality Work. http://siddiq-sharepoint2010.blogspot.in/ Siddiqali Mohammad .

    Hi,
    According to your post, my understanding is that you got an error when read calendar list items using CAML.
    I created two single line of text columns in the Calendar( Year and Month), then add items in the Calendar to check with your code. The CAML query worked well as below.
    string year = "2014";
    string month = "February";
    using (SPSite oSiteCollection = new SPSite("Your site URL"))
    using (SPWeb myweb = oSiteCollection.OpenWeb())
    SPList mylist = myweb.Lists["Calendar"];
    SPQuery myquery = new SPQuery();
    myquery.Query = @"<Where> <And> <Eq> <FieldRef Name='Year'/> <Value Type='text'>" + year
    + "</Value></Eq><Eq>+ "
    + " <FieldRef Name='Month' />+ "
    + " <Value Type='text'>" + month + "</Value>+ "
    + " </Eq> </And></Where>";
    SPListItemCollection totaltiems = mylist.GetItems(myquery);
    Console.WriteLine( "Total Number of Items is " + " " + totaltiems.Count.ToString());
    Console.ReadLine();
    Which type of the two columns in your Calendar? Were they text type?
    Are you sure the field name(<FieldRef Name='Year'/>,
    <FieldRef Name='Month' />) is same as internal name?
    We should only use internal name while refrencing columns in CAML query. If you have space In you column , replace it with "_x0020_", such as
    News_x0020_Category. 
    Thanks & Regards,
    Jason 
    Jason Guo
    TechNet Community Support

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

  • How to retrieve Task Lists from All Subsites to the Parent Site and display in Grid view using CAML Query

    How to retrieve Task Lists from All Subsites to the Parent Site and display in  Grid view using CAML Query + object model

    do u just want task list or items under task list for all subsites
    for items use spsitedataquery ref
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx use recursive to get it from alll subsite under site collection
    for tasklist only u can a simply use a for loop to find in all subsite
    Manish Sati

  • Open a SharePoint List item in Modal Pop up in SP 2013 fails after you filter or sort the list

    Sorry for the long post. This has been killing me. I had this script working perfectly fine in SharePoint 2010 (online) and basically i have a source custom list (list A) with a hyperlink column and a Destination List with say title and my name.
    Source List (list A) looks like this with these 2 columns
    Title    Test Link
    A         Link 1
    B         Link 2 
    C         Link 3
    Each of these links link to the actual list item in the destination list, so for example, link 1 is/sites/2013DevSite/Lists/Destination%20List/EditForm.aspx?ID=1
    So basically i want anytime the Link are clicked that point to another list's item to open in a modal dialog and the script below worked perfectly fine in SharePoint 2010 (online)
    <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
    <script language ="javascript" type="text/javascript">   
    jQuery(document).ready(function() {
    jQuery('a[href*="EditForm.aspx"]').each(function (i, e) {
    // Store the A tag's current href in a variable
    var currentHref = jQuery(e).attr('href');
    jQuery(e).attr({
    'href': 'javascript:void(0);', 
    // Use the stored href as argument for the ShowInModal functions parameter.
    'onclick': 'ShowInModal("' + currentHref + '");'
    function ShowInModal(href) {
    SP.UI.ModalDialog.showModalDialog({title: "Edit Item", url: href});    
    </script>
    All it does is find the href tags for that particular value Editform.aspx and the pop modal works in SP 2010 online. So the site page is designed in such a way there is a content editor web part with the reference to this javascript file and the sharepoint
    list is right beneath it and this worked perfectly opening in modal windows in SP 2010.
    Since migration to 2013, this is what exactly happens
    1.) when you come to the site page, the modal works,
    2.) If you filter or sort on say the Title or Test Link column in Source list (lets say you select the Value A), the script does not fire at all, if i hover over the hyperlink, the who hyperlink is shown and does not open the hyperlink in the modal pop up.
    - This is important because i want to be able to sort on a particular item...
    Could someone please let me know what am i doing wrong and why is this not working when i sort the list. Thanks for all the help.
    Once again i am trying to open a sharepoint list item in Sharepoint 2013 from another list using Jquery

    A ListItem has its own unique row id so in all likelihood, an insert with the same data will result in a new list entry. The Lists Web Service however, has an UpdateListItem method which will take an update request. [refer
    http://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.15).aspx ]
    There is another note in the conference (marked answered) to your List Item Update problem. Probably worth a try too. [refer
    http://social.msdn.microsoft.com/Forums/en-US/bee8f6c6-3259-4764-bafa-6689f5fd6ec9/how-to-update-an-existing-item-in-a-sharepoint-list-using-the-wss-adapter-for-biztalk?forum=biztalkgeneral ]
    Regards.

  • Use paging in Sharepoint List items

    Hi ,
    I am having one sharepoint 2013 . I have written the code to read sharepoint custom list item using C# and Jquery both ..My List is having 5000+ items into list ,and when I am binding those records into my Gridview It is taking time to bind the data
    into Gridview. I am using Paging of 10 items per page ..still I am facing performance issues .. 
    Could any one help me on same ... 
    Thanks..

    Hi,
    For your issue, you can use SPListItemCollectionPosition in your GridView and query page by page:
    http://sharepoint.infoyen.com/2012/03/06/sharepoint-list-pagination-using-splistitemcollectionposition/
    http://www.codeproject.com/Articles/407558/SharePoint-using-SPListItemCollectionPosition
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Get list items using spservices for sharepoint 2013

    Hi,
    I have a requirement like below.
    I have 2 sharepoint custom list with some columns.
    List1:listA
    List2:listB
    Now when i open the listB new item form i want some of the field values from listA should auto populate in Textboxes of listB new form.
    Is there any ways to implement this?
    Regards,
    Poovi

    Hi Poovi,
    You can achieve this using jQuery to get the SharePoint list items. Refer the below articles. It has explained how to get list items using jQuery and auto populate a text-box from a list item as a source.
    You can put this code in list forms through SharePoint Designer. The articles explain about auto populating text box of web part but similarly you can implement it for list form, because nevertheless the text boxes are same.
    http://www.c-sharpcorner.com/UploadFile/sagarp/sharepoint-2010-jquery-autocomplete-textbox-containing-list/
    http://tomvangaever.be/blogv2/2011/07/sharepoint-2010-autocomplete-with-list-items/
    Please remember to click 'Mark as Answer' if the reply answers your query or 'Upvote' if it helps you.

  • Uploading multiple documents into sharepoint list item with REST in sharepoint 2013 using content editor web part :

    hi ,
    i am trying to upload multiple document files into sharepoint list item. I followed below link for implementaion.
    http://techfindings-prem.blogspot.in/search/label/jquery.multifilejs
    It was working for sharepoint hosted app.
     This complete code is written within content edito web part.
    It was working when i was in root site collection with below change (hard coded the root level url) in code in "UploadFile" function.
    var scriptbase = "http://servername" + "/_layouts/15/";
                console.log(' File size:' + bytes.length);
                $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    But the issue came in picture when i was working with the other site collection instead of root one. The url was like below.
    "http://servername/sites/cpg/". This time i need to be there within "cpg" site collection. 
    Now if i hard code the url as i did above my code gets break here while come to below line
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
    I am getting error when i used below code:
    var scriptbase = "http://servername" + "/_layouts/15/";
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    Please hekp in this case. This complete code is written within content edito web part. 
    Regards:
    Sanjay Joshi

    Hi,
    According to your post, my understanding is that you have an issue about upload multiple documents files into library vai REST API.
    As you have said, you have used the hard code url in your code.
    How about use the _spPageContextInfo.webAbsoluteUrl method to get the url?
    I have used this method to get the url, then use the code in the article you have pasted within a content editor web part to upload the files.
    You can replace the hard code url with the _spPageContextInfo.webAbsoluteUrl method, then check whether it works.
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • SharePoint 2013 document generation from list items using workflow

    I have been able to generate docs from list items using sharepoint designer workflow.But i have been able to do this with using one document template. But i have like 6 templates i would like to use what do i need to do to get this rolling would i need to
    have 6 different doc libs with a doc template?
    Thanks in Advance

    Thanks Sharma.
    I have create 6 content type and associated doc templates to them. I read I should be using .docx instead of dotx which I also tried
    But im still getting the error
    When I click details no error details  to help at all.
    Can anyone who is having this issue help or give me some hints.
    Cheers

  • Report workload by calculating how many versions of SharePoint list items created in a certain time period

    I have a total of 66 SharePoint 2010 lists - yes, 66! - each lists contains between 1500 and 3200 list items.  My employees update these various list items throughout their workday.  Each update to a list item creates a new version of the list
    item.  On average each list item will have anywhere from 5 to 10 versions before it is done.  I need to create a report that tells me how many list items they've updated in a certain time frame.  I have come close but still cannot arrive at
    the data I'm looking for. 
    This is what I have so far:
    I've created a report using SQL Report Builder 2008 v3 where I've filtered it to show only items MODIFIED between, for example, Feb1 and Feb28.  Of those records, I want the report to tell me how many versions were created during that time
    frame.  The result is one list item with 5 total versions.  Versions 1.0, 2.0, & 3.0 were created on 12/12/14.  The last two versions, 4.0 and 5.0, were created on 2/24/15.  Therefore, the answer I'm looking for is 2 because they
    created 2 versions between Feb1 and Feb28.
    However I get the following results using these queries:
    If I do a =Sum(Fields!owshiddenversion.Value) in the expression field I get the total versions which is 5
    If I do a =Count(Fields!owshiddenversion.Value) in the expression field I get the instance which is 1
    Is there a way to count ONLY the number of versions created in a time period?  Is there another hidden field in SharePoint that I can use in the expression that will give me results I'm looking for?

    Hi Rafael70,
    Per my understanding that you have already get all the need fields and informaiton of the updated version of list items and now you want to calculate how many versions of SharePoint list items created in a certain time period, you can't get desired result
    using sum and count function, right?
    I have tried to tested on my local environment but because I am not clear what is value in the field "owshiddenversion", I assumed you have two datatype parameters (StartDate and EndDate) to help filter the report in a certain time period.
    Generally, if you have add the filter correctly, it will filter the correct number's updated version in this time period, I would like you to provide details information as below to help better analysis the requirements:
    Could you please provide sample data of the table.
    Please provide snapshot of the report structure you have currently designed.
    Please try to provide all the expression you have used.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

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

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • Rating a List Item using jquery with out using User profile service

    Hi,
    I dont have access to Central admin and i was not not able to enable USer profile service.
    can i rate a list item in Sharepoint 2010 using any jquery plugin
    i got the link
    http://blogs.msdn.com/b/carloshm/archive/2009/08/24/jquery-rating-in-sharepoint-lists.aspx
    But i am not able to find any plugin in it.
    Please advice.
    Thnaks,
    Pallavi

    Hi,
    According to your post, my understanding is that you wanted to rate a list item using JQuery in SharePoint 2010.
    The link you had posted above is for SharePoint 2007.
    You can refer to the following articles which about using the JQuery to call the rating service.
    http://blog.dennus.net/2011/08/09/using-spservices-and-jquery-to-include-social-rating-control-on-_layouts-page/
    https://www.habaneroconsulting.com/insights/Calling-the-Rating-Service-using-jQuery-in-SharePoint-2010-Part-1-of-2#.UxbQxvmSz6k
    You can also use the tool of the CodePlex to achieve it.
    http://sptoolbasket.codeplex.com/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Link to Sharepoint List Item

    I have a report that I built in SQL Report Builder 3.0 that pulls data from a SharePoint 2013 list. The fields are data, location, cost, department, and reference. The reference field is number that is input by the user on the SharePoint 2013 list. Is
    there a way for the reference field in the report to be a direct link back to open the SharePoint list item when it is clicked in the report?

    Hi,
    According to the description, I know you want to redirect to the SharePoint site by clicking on the value in the reference field in your report. Take the steps below to achieve this:
    1. Right-click reference field > Text box Properties in the designer surface.
    2. Click on Action page, check the option of Go to URL.
    3. In the Select URL box, type the URL of your SharePoint list.
    e.g. http://TestServer/toplevelsite/subsite/Lists/<Listname>/AllItems.aspx
    4. Click ok. Save and upload the report.
    This URL redirects to the SharePoint list page. If you want to redirect to the display form page of an item,
     use the code like:
    ="javascript:void(window.open('http://servername/sites/xx/Lists/listname/DispForm.aspx?ID=" & Fields!ID.Value & "&Title= "& Fields!Title.Value &"'))"
    ID and Title are used to identify the item which redirect to. You can change it according to the columns.                                                                                                                                                                                          
    Thanks.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for