SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just a quick question, is there any chance, how to get list of users, which rates items in one list, or documents in one library ? Maybe I only overlook something really obvious...

Thank you

share|improve this question

You can write a powershell with foreach for a site collection or a web and get a output text file.

# get the site collection
$s = get-spsite http://siteurl 

# loop through all site in the site collection, 
# then through all lists / libraries in that site (filtering out everything but actual doc libs 
# (The catalog filter excludes all sharepoint libs like the masterpage catalog etc.
// for each list, add a folder called test to the rootfolder
$s.AllWebs | Foreach-Object { 
  $_.Lists | Where { ($_.BaseType -eq "DocumentLibrary") -and ($_.BaseTemplate -notmatch "Catalog") } | Foreach-Object {
    # Do your code here and if u need to include basetype do so
share|improve this answer
Thank you very much Ken! Can you write me the BaseType and Template for lists please? I'm not able to get list of users for list objects. – Molik Jul 2 '12 at 11:19

SocialRatingManager.GetRatings can give you all Ratings for an Url or for a User.
See MSDN article How to: Create and Retrieve a Social Rating for more info for more info on how to work with ratings programatically

To get all ratings for a single library you can use code like this:

using System;
using Microsoft.Office.Server.SocialData;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

namespace SharePointConsoleApplication1
    class Program
        static void Main(string[] args)
            var url = "http://sp2010/TestDocs";
            using (var site = new SPSite(url))
                var sc = SPServiceContext.GetContext(site);
                var sm = new SocialRatingManager(sc);
                using (var web = site.OpenWeb())
                    var list = web.GetList(url);
                    foreach (SPListItem item in list.Items)
                        foreach (var rating in sm.GetRatings(new Uri(SPUrlUtility.CombineUrl(site.MakeFullUrl(web.ServerRelativeUrl), item.Url))))
                            Console.WriteLine("{0} rated {1} to {2}", rating.Owner.DisplayName, rating.Url, rating.Rating);
share|improve this answer
how can i convert it to web part for appear in dashboards? – saber tabatabaee yazdi Jul 29 '13 at 11:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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