Enable Rating/Likes programmatically in sharepoint 2013

1.Enable Rating/Likes

    Assembly assembly = Assembly.Load("Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
            Type reputationHelper = assembly.GetType("Microsoft.SharePoint.Portal.ReputationHelper");

            MethodInfo method1 = reputationHelper.GetMethod("DisableReputation", BindingFlags.Static | BindingFlags.NonPublic);
            method1.Invoke(null, new Object[] { postsList });

            MethodInfo method2 = reputationHelper.GetMethod("EnableReputation", BindingFlags.Static | BindingFlags.NonPublic);
            // "Likes" or "Ratings" as per your requirement.
            method2.Invoke(null, new Object[] { postsList, "Ratings", false });

            postsList.Update();

2.Build-In Fields about Rating/Likes

  

3.Set Rating/Liking Programmatically

  http://www.cnblogs.com/PeterHome/articles/3457655.html

posted @ 2014-01-08 18:31  【上海】Peter  阅读(457)  评论(0)    收藏  举报