I am using SharePoint 2013, cloud version. We are very limited in what we can customize. I have created a site that uses the Enterprise Wiki template.

A feature that was requested is to show a list of favorite wiki pages. Since it seems that a person can only "Follow" a site, I would have to get the information from the Page Rating displayed.

Is there a way, using jQuery/JavaScript to get the list of ratings for all the pages in the wiki Pages area?

I figure, if I can get all the ratings for the user, I can filter it by those with 3 or more stars and list those pages.


The following examples demonstrate how to retrieve rating information (in Ent. Wiki site wiki pages are stored in Pages library)

How to get rating info via SharePoint JSOM API

var webUrl = _spPageContextInfo.webServerRelativeUrl; //Enterprise Wiki web site url
 getListItems(webUrl, 'Pages',
       var ratingsInfo = {};
       for(var i = 0;i < items.get_count();i++) {
           var item = items.get_item(i);
           ratingsInfo[item.get_item('FileRef')] = { 'AverageRating' : item.get_item("AverageRating"), 'RatingCount' : item.get_item("RatingCount") };


function getListItems(webUrl,listTitle,success,error)
   var ctx = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);
   var list = ctx.get_web().get_lists().getByTitle(listTitle);
   var items = list.getItems(SP.CamlQuery.createAllItemsQuery());
   ctx.executeQueryAsync(function() {

How to get rating info via SharePoint REST API

var getRatingsInfo =  function (webUrl) {
    var listTitle = "Pages";
    var url = webUrl + "/_api/web/lists/GetByTitle('" + listTitle + "')/items?$expand=File";
    return $.getJSON(url,function( data ) {
        var info = {};
            info[item.File.ServerRelativeUrl] = { 'AverageRating' : item.AverageRating, 'RatingCount' : item.RatingCount }; 
        return info; 

var webUrl = _spPageContextInfo.webServerRelativeUrl;
| improve this answer | |
  • Does this get the average rating for the Page? Is there a way to get The Current User's rating for the Page? – LoganSix Apr 20 '15 at 12:53
  • Yes, it returns the AverageRating and RatingCount properties for pages – Vadim Gremyachev Apr 20 '15 at 12:54
  • What about the Rating that the Current User gave the Page? I apologize that I didn't clarify that part in my initial question. – LoganSix Apr 20 '15 at 13:03
  • I'm afraid you have to be more specific, what page, some specific page or all pages in the library? – Vadim Gremyachev Apr 20 '15 at 13:08
  • All Pages in the Wiki Library. I want to show all the Pages with the Current User's Rating and then filter it to Ratings 3 stars or greater. – LoganSix Apr 20 '15 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.