質問

Can we get total number of available records in SharePoint 2013 site using REST API and Query Language FQL.

I did checked http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx?CommentPosted=true#commentmessage

But was not able to get Count of available records.

Thanks for help!

役に立ちましたか?

解決

SharePoint REST Search API does not expose any specific parameter to return total results count, but contains query.PrimaryQueryResult.RelevantResults.TotalRows value in response.

The following example demonstrates how to return the total results count:

$.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='news'&rowlimit=100",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            console.log(data.d.query.PrimaryQueryResult.RelevantResults.TotalRows); //get total results count
        },
        error: function (data) {
            console.log(JSON.stringify(data));
        }
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top