Using the SharePoint Social Comment Web Part

This issue has been miserably annoying to me, and I have spent a long time figuring out how to appropriately utilize the SharePoint Social Comment Web Part.

Here’s how to do it.

I know this works with SharePoint 2010.  This might work in SharePoint 2013…

1. To your web part project add a reference to the Microsoft.Sharepoint.Portal namespace.  This is NOT listed in the “Extensions” section of Visual Studio, and you’ll need to browse for it.

c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ASAPI\microsoft.sharepoint.portal.dll

2. Create a placeholder in your Web Part’s ASCX file…

<asp:PlaceHolder runat="server" ID="plcComments"></asp:PlaceHolder>

3. Add a SocialCommentsWebPart to the placeholder in your Web Part’s .ascx.cs file

You can replace the Page.Request.Url.AbsoluteUri part with any URL.

4. The comments form should appear upon page load.   You might need to wrap the code in step 3 with  if(!IsPostBack){ ... }  but this usually works.

Leave a Reply

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