SharePoint 2013 Rest API - How to get the item count with startsWith

Hi All,
I am using the below url to get the item count for specfied startsWith. For example I want to know how many items are there in the list which starts with "A". When i hit the below url in the address bar i am getting HTTP not found.
siteURL/sites/Apps/SharePointApp3/_vti_bin/listdata.svc/SampleList/items?$filter=startsWith(Title,’A’)
Navaneeth

what
is SharePointApp3.
here. 
it is a webpart.
this will not work on webpart\apps
Also I am not sure if it will work with specific SampleList 
Try 
siteURL/sites/Apps/SharePointApp3/SampleList/_vti_bin/listdata.svc/Keywords?$filter=substringof('r',Title)
If this helped you resolve your issue, please mark it Answered

Similar Messages

  • SharePoint 2013 Rest Api - How to get List Items

     
    Can anyone let me know why the below method fails? I am not getting where i am making mistake. Please help
    function getListItems(term) {
                var caml = "<View><Query><Where><BeginsWith><FieldRef Name=Title/><Value Type='Text'>" + term + "</Value></BeginsWith></Where></Query></View>";
                var requestData = { "query": { "__metadata": { "type": "SP.CamlQuery" }, "ViewXml": caml } };
                $.ajax({
                    url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getbytitle('SampleList')/Getitems",
                    method: "POST",
                    data:requestData,
                    headers: {
                        "accept": "application/json; odata=verbose",
                        "content-type": "application/json; odata=verbose"
                    success: function (data) {
                        $("#countItem").html("Pass");
                    error: function (data) {
                        $("#countItem").html("Fail");
    Below is the responseText (log)
    "{\"error\":{\"code\":\"-1, Microsoft.SharePoint.Client.ClientServiceException\",\"message\":{\"lang\":\"en-US\",\"value\":\"The HTTP method \'GET\' cannot be used to access
    the resource \'GetItems\'. The operation type of the resource is specified as \'Default\'. Please use correct HTTP method to invoke the resource.\"}}}"
    Navaneeth

    Finally executed successfully using below code. The learning is we need to use  type:"POST" instead of method:"POST"
     function getListItems(term) {
                var urltest = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/lists/getByTitle('SampleList')/getitems(<Query><Where><BeginsWith><FieldRef">query=@v1)?@v1={\"ViewXml\":\"<View><Query><Where><BeginsWith><FieldRef
    Name='Title'/><Value Type='Text'>" + term + "</Value></BeginsWith></Where></Query><RowLimit>1</RowLimit></View>\"}";
                $.ajax({
                    url: urltest,
                    type: "POST",
                    headers: {
                        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                        "Accept": "application/json; odata=verbose",
                        "Content-Type": "application/json; odata=verbose"
                    contentType: 'application/json',
                    success: function (data) {
                        if (data.d.results.length != 1) {
                            $("#countItem").html("Pass");
                            $("#" + term).parent().parent().prop('disabled', true);
                            $("#" + term).removeAttr("onclick");
                            $("#" + term).css('cursor', 'default');
                            $("#" + term).parent().unbind("mouseenter mouseleave");
                    error: function (data) {
                        $("#countItem").html(urltest);
    Navaneeth

  • SharePoint 2010 Rest API: How to add attachment to a list item via ListData.svc

    Hi
    I have set up a project using the REST API in c# Visual Studio 2010.
    I have added a service reference to the URL //site/_vti_bin/listdata.svc/
    I can query the list and get back data, but I can't retrieve the attachments.
    I can write data to the list, but I can't add attachments.
    Are there any examples of how to add or retrieve attachments using the REST API services.
    Thanks
    Mike

    Hi,                                                             
    If you want to work with list attachments using REST API, here are some links will show how to do this using Javascript:
    http://msdn.microsoft.com/en-us/library/office/dn292553.aspx#FileAttachments
    http://chuvash.eu/2013/02/20/rest-api-add-a-plain-text-file-as-an-attachment-to-a-list-item/
    http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/06/27/how-to-get-list-item-attachments-using-rest-and-javascript-in-sharepoint-2013.aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to get the row Count of a ResultSet

    How to get the row Count of a ResultSet

    Hi
    I'v tried rennie1's way ,but I only get zero,my code is:
    rs.executeQuery("select count(*) from t_test");
    if (rs.next()) int rowCount=rs.getInt(1);
    I also tried barni's way ,but the method rs.last() and rs.beforeFirst() throw a same Exception
    I tried another way,the code is:
    while rs.next(){
    // Do nothing ,just move the cursour to the last row
    int rowCount=rs.getRow()
    However,the rowCount still equal zero
    Any help would be greatly apprecite!
    note:
    I get connection by DataSource's JNDI name from client, the Server is Weblogic Server 6, the DBMS is Oracle.

  • How to get the contents associated with a component.

    How to get the contents associated with a component.
    Like i have 2 buttons and i want to get the contents associated with these button without clicking them i.e without firing the event.
    By Contents i mean, whatever things we get after firing the event,we get some other window and some thing is added to the current page and so on.

    grab all the code inside the actionPerformed(ActionEvent e) method

  • How to get the column count at the bottom of the column

    Hi Friends,
    How to get the column count at the bottom of the column
    Thanks
    Raj

    You mean row count? Add another column, click on the fx button and type RCOUNT(1).
    If you want just the total you can make it MAX(RCOUNT(1)), hide this column and then add a Narrative View after your report and enter "Total Number of Records: @n" where "n" represents what order your column is from the left side.

  • SharePoint 2013 REST API with C# - Mapping HTTP verbs to data operations - Requesting FormDigest

    SharePoint REST interface maps HTTP verbs to data operations. Endpoints that represent
    Read operations map to HTTP
    GET commands. Endpoints that represent update operations map to HTTP
    POST commands, and endpoints that represent update or insert operations map to HTTP
    PUT commands (Ref:
    How to: Complete basic operations using SharePoint 2013 REST endpoints).
    Is this mapping of HTTP verbs to CRUD operations a design paradigm or whether there are other technical reasons to this mapping
    Is is possible to use a GET command for say an update operation or a POST for say a read operation.If so, what consideration make the choice of either usage
    In the code snippet below FormDigest is requested as POST, why not use GET here?
    private static string GetFormDigest(string webUrl)
    //Validate input
    if (String.IsNullOrEmpty(webUrl) || String.IsNullOrWhiteSpace(webUrl))
    return String.Empty;
    //Create REST Request
    Uri uri = new Uri(webUrl + "/_api/contextinfo");
    HttpWebRequest restRequest = (HttpWebRequest)WebRequest.Create(uri);
    restRequest.Credentials = CredentialCache.DefaultCredentials;
    restRequest.Method = "POST";
    restRequest.ContentLength = 0;
    //Retrieve Response
    HttpWebResponse restResponse = (HttpWebResponse)restRequest.GetResponse();
    XDocument atomDoc = XDocument.Load(restResponse.GetResponseStream());
    XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
    //Extract Form Digest
    return atomDoc.Descendants(d + "FormDigestValue").First().Value;
    Thanks - Abhishek

    Many SharePoint REST api methods use parameters. It is much more efficient to post parameters than use query string variables.  Many times complex types are sent and these require json notation objects posted in the body. In the case of "_api/contextinfo,
    it is recommended to use POST rather than a GET when using sensitive data. GET responses can be cached. Since you are getting a security token back in that call it is recommended to use a POST.
    http://blog.teamtreehouse.com/the-definitive-guide-to-get-vs-post
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • Sharepoint 2013 REST API calls with JASONP support

    We are working on sharepoint online integration with PHP Based application. We need to provide REST API call which supports JSONP.
    So is it possible to create new REST API Endpoints in Sharepoint online APP? Please sugggest right direction.

    Hi,
    In Office 365 (aka SharePoint Online), you can simply consume the SharePoint data through REST API or WS call,but cannot create your own endpoint.
    By default you can get the JSON response from the Office 365 REST API,its upto you to use the JSONP on your client compatibility not on SharePoint online REST API.
    Sometime before I tried, It didn't work for me.
    If you develop the AppModel, SPRequestor.js does the same job(overcome the Cross domain restriction) the what JSONP does.
    Murugesa Pandian| MCPD | MCTS |SharePoint 2010

  • File Adapter - how to get the file count from a folder

    Hi All,
    I have a requirement that have to poll a directory when the file count is reached to number N (ex:number of files avilable in folder is 5) otherwise it should wait and not pick any of the files. Is it possible to get the file count from a folder using file adapter ?? otherwise please suggest me an approach to achieve this requirement.
    Thanks,
    JJ

    Hi Sarath,
    Thank you for your reply.
    Go with the list files operation of file adapter it will gives you the number of files in the specified folder as you given. . - this step is already done.
    When the number of files reaches your count startup your webservice that which can polls the files. . . - how can i acheive this?? Have to poll the directory and process the number files - please let me know, what could be added to the webservice which is being invoked after cheking file count from parent process.
    The reason for the above question is - we cannot use ReadFile operation in second webservice because it will be automatically triggered when the file is avilable. Also SyncRead operation supports reading one file in b/w bpel process. Kindly explain me the implementation steps.
    Thanks,
    JJ

  • How to get the FILE COUNT from File directory

    Hello,
    i have to develop a scenario like, get  the file count from source file directory and validate whether the file count is 5 or not. if 5 files exist i need to process those 5 files to DB tables. if file count is not equal to 5 then i need to send a mail to customer that files are missed at source directory. (subject as files were missed at source directory and in content i need to display the file names exist at source file directory. So that missed file will be generated by the customer based on this mail).
    Could you please let me know how to get the count of files from source file directory. if it is possible only with UDF please provide the Java code
    Best Regards,
    SARAN

    Do these files have some fixed names?
    Can you try to use the option Advanced Selection For Source File to make XI  pick all 5 files in one shot?
    Check this blog on the same -
    /people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter
    If this is not a option - BPM sounds the only possible way.
    Regards,
    Bhavesh

  • How to get the application expose with a mouse

    Hi,
    I want to get a quick overview of all open windows of the SAME application (= application expose). Normally, you can do this with your trackpad (three or four fingers down movement); I am now working with a "normal" (non-Apple) mouse and keyboard. How do I get the application expose with the mouse? I am able to quickly get the misson control wiht CTRL + right mouse click; and I am getting the App expose with shift + arrow down.
    Isn't there a way to get the application expose with the mouse as well? E.g. CTRL + Shift + right click would be very useful but that's taken by the 'slow moving' mission control.
    I know, it's a minor detail but it would be quite good for the workflow
    Any hint is most welcome. Many thanks.

    grab all the code inside the actionPerformed(ActionEvent e) method

  • How to get the record count printed for the report in the Dashboards

    Hi,
    I would like to get the record count printed at the bottom of every dashboard report like:
    < 1 - 25 of 6300 > instead of < 1 - 25 >
    Any help is appreciated
    Regards
    B

    I have tried the following formula which identifies the lowest grain but it does not seem to give me correct result.. I am not getting the correct count. I am getting as 3.A work order can be updated only once at one point of time.hence the formula
    MAX(RCOUNT(CAST("SR Wo Fact"."Crm Wo Number" AS CHAR) ||CAST("SR Wo Fact"."PSC Timestamp" as char)))
    I tried only MAX(RCOUNT(1)), but I was able to get the record count as corect for Administrator but not for other users.
    Has anyone come across this scenario.
    Thanks Shravan
    Edited by: 786443 on Aug 19, 2010 10:22 AM

  • How to get the item stock for a date

    Hi all
    I need to get the item stock quantity on a date, but i don´t know if i can get it from a table or if i have to make a query to calculate it from the documents´lines. If you can help me please reply this post.
    Thanks

    Do you already know of table OINM (Warehouse table) - it is not documented in SAP-BO references?
    This table contains entries for each movement in stocks of your system. Here are some examples of fields in this table:
    BASE_REF document number of document affecting OITW.OnHand
    DocDate      date of this document
    ItemCode     Item of which the stock quantity is changed
    Dscription    name of item
    Warehouse  affected stock
    InQty       number of items added into stock (OITW.OnHand is increased)
    OutQty       number of items taken from stock (OITW.OnHand is decreased)     
    TransType   type of booking (see below)
    Balance      this is NOT the OITW.OnHand at the date of this booking;
                      it's something like the cumulated stock value in some currency
    To calculate the OnHand-value at a date of any of these bookings you have to
    sum up the incoming/outgoing quantities, e.g. (z.B. SUM(InQty) - SUM(OutQty)).
    Relation between the type of booking and the values in InQty / OutQty:
      ++ InQty/OutQty contain the number of items added to/taken from the stock;
      the number complies to the value OITW.OnHand is increased/decreased;      
      -- doesn't affect stock (InQty/OutQty = 0)
      ? missing documentation
    TransType InQty OutQty
    -2              ++     --         opening balance
    13      --       --         outgoing invoice
    13              --      ++          outgoing invoice without previous delivery note
    15              --      ++        delivery note
    18              --       --         incoming invoice
    20             ++      --         incoming delivery note
    58             ?        ?          inventory
    59             ++      --         stock receipt (without purchasing transactions)
    60              --      ++        goods issue (without sales transactions)
    67              --      ++        transfer between stocks
    67             ++      --         transfer between stocks
    I hope that I got your question right and that my hints will help you!
    Frank

  • How To Get Deleted Item Count and Associated Item Count And LastLogOn and LogOff Time For A Mailbox In Exchange Using EWS

    Using Powershell cmdlet i get  all the details..But i want to get these Details by using EWS Managed Api.Is It Possible to do???
    Powershell Cmdlet,
    Get-MailboxStatistics -Identity Username, Using this cmdlets all the details will get displayed.
    DeletedItemCount:5 //Here how this count comes.In My OutlookWebApp the deleteditems folder contains 13 items in it..But the count shows only 5.
    TotalDeletedItemSize:5.465 Kb//Even this value too does not match with DeletedItems Folder size in owa.
    AssociatedItemCount:12
    LastLogOnTime:11/11/11 12:43PM
    LastLogOff Time:11/11/11 2:43PM
    In EWS,
    By Looping through all folders i can get the total item count and total item size.Even i can get deleteditems  count .But that value does not match  With the powershell value.Even the TotalDeletedItemSize
    Doesnt match.
    Using EWS Managed Api ,Looping through folders i can get ItemCount,TotalitemSize,(DeletedItems,TotalDeleteditemSize(These TwoValues Does not match with values comes from powershell))
    Now how to get the Associated item count and lastlogoff and logon time using EWS managed Api.Is it Possible???
    And even y the deleteditems count and size values varies between EWS and powershell.

    What happens if you execute the below code?
    Get-MailboxFolderStatistics [email protected] | where {$_.FolderPath -like "/Deleted Items"}
    Refer this blog. You may get some dice
    http://exchangepedia.com/blog/2008/09/configuring-deleted-item-retention.html
    Regards Chen V [MCTS SharePoint 2010]

  • Trying to Access SharePoint 2013 Rest Api in HTML page but getting Mime Type Exception with Status Success

    I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and
    Status Success but still I am getting the below error.
    Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME
    type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
        <script>
            $(document).ready(function () {
                $("#KMPDiscussions").click(function () {
                    //$.support.cors = true;
                    $.ajax({
                        url: "http://<server>/_api//web/lists",
                        dataType: "jsonp",
                        type: "GET",
                        method: "GET",
                        contentType: "application/javascript",
                        headers: {
                            "content-type":
    "application/json;odata=verbose",
                            "accept": "application/json;odata=verbose",
                        success: function onSuccess(data) {
                            alert("Inside Alert");
                        error: function onError(data){
                            alert("Error: "
    + data);
        </script>
    It always hits the error on callback.
    Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.

    Hi Chris,
    Thanks for the reply,Here iam using different files to be uploaded in library.
    please find the below snapshot of json response and ULS logs.
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    abq2i High Could not get DocumentContent row: 0x80004005. 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aiv4w Medium Spent 0 ms to bind -1 byte file stream 79f7629c-4694-c026-3349-
    2049178ee919 
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aise3 Medium Failure when fetching document. 0x80070012 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x0D4C SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-2c9132b13e9a
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x4184 SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-281167b6cd09
    Thanks again,
    Naresh.

Maybe you are looking for

  • Sub-Script  Value in ALV  Report Output

    Hi, Let us take an example Hydrogen - H2, If we print it in this way it won't be meaning full, So i want to display this like H Subscript 2. I have a requirement for a column in an ALV Report. Is it Possible? Please give me an example. Thanks, Sekhar

  • Has anyone else been mislead by Time Machine?

    Before I start, I'd like to make a little disclaimer that before the trolls set to work on berrating my naivity for the problem i've suffered, i'd just like to say "I KNOW THAT NOW" and hindsight is such a wonderful thing but unfortunately, the simpl

  • Transfer from MP3 disc to PC Music Libr

    Can anyone advise on how to transfer tracks from an MP3 disc to PC Music Library in Media source? I use the Media source and transfer the tracks to my PC but can't access the MP3 tracks later to burn a CD or transfer to the Zen Micro. The location of

  • Repository Service not working

    Hi all, I have designed a very simple repository service based on the several code samples here on the forums. Here is the received(IEvent) method i implemented: public void received(IEvent event) {        IResourceEvent resEvent = (IResourceEvent) e

  • Customize the load order of symbols

    Hey everyone! I have a question that after search the forum could not find an answer to. So I decided to make a new post I am working on a rather large edge animation, and so far it all looks and renders real nice. What it is is a web banner with a p