Enable Likes or Rating on a SharePoint List programmatically using reflection

For some reasons there is no public property to enable likes or ratings on a list in SharePoint. Using reflection, this is still possible to do. Feel free to use this codesnippet for SharePoint 2013 on-premises.

private static void EnableLikes(SPList list)
{
    Assembly theAssembly = Assembly.Load("Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
    Type reputationHelperType = theAssembly.GetType("Microsoft.SharePoint.Portal.ReputationHelper", false, true);
    MethodInfo milf = reputationHelperType.GetMethod("EnableReputation", BindingFlags.Static | BindingFlags.NonPublic);
    milf.Invoke(reputationHelperType, new object[] {list, "Likes", false});
    list.Update();
}

1 thought on “Enable Likes or Rating on a SharePoint List programmatically using reflection”

  1. Hi,

    what exactly stands milf in your example for? and no… I wasn’t searching for this in internet as I forwarded to your site.

    Regards

Leave a Reply

Your email address will not be published. Required fields are marked *