February 14, 2012

Cannot set Note Board Web Part title in Page Layout

Challenge

When adding SocialCommentWebPart to your Page Layout with SharePoint Designer and trying to set the title of the web part, you cannot do it. SPD removes the Title attribute when you save the Page Layout file.

Here are the exact steps.
  1. Check out Page Layout file in SPD 
  2. Edit File in Advanced Mode 
  3. SocialCommentWebPart looks like this (removed all attributes that are not relevant):

    <SPSWC:SocialCommentWebPart runat="server" Title="" ...></SPSWC:SocialCommentWebPart>
  4. Add Title for the SocialCommentWebPart using the Tag Properties Task Pane in SPD 
  5. SocialCommentWebPart looks like this:

    <SPSWC:SocialCommentWebPart runat="server" Title="Comments &amp; Questions" ...><SPSWC:SocialCommentControl runat="server">
    </SPSWC:SocialCommentControl>
    </SPSWC:SocialCommentWebPart>
  6. Save Page Layout file in SPD by clicking Save 
  7. Check In the Page Layout file and select Publish a major version 
  8. Verify that the Page Layout file still contains SocialCommentWebPart tag and Title as in step 5. 
  9. Close Page Layout file in SPD 
  10. Edit the Page Layout File in Advanced Mode in SPD (do not check out the file) 
  11. SocialCommentWebPart tag has reverted to what it was in step 3

    <SPSWC:SocialCommentWebPart runat="server" Title="" ...></SPSWC:SocialCommentWebPart>
  12. Obviously using that Page Layout will result in SocialCommentWebPart having Untitled title 

Solution

According to Microsoft support, this is by-design and a feature of the product. To alter this functionality I created a simple jQuery script to change the title of the web part and placed the script in my .master page.

ExecuteOrDelayUntilScriptLoaded(function () { $(function() { // Set Note Board title $('td[title="Untitled"] span:first').html("Comments & Questions"); }); }, "sp.js");

There is also a PowerShell based workaround for this that might work in some cases here.

Technorati Tags: SharePoint,jQuery

5 comments:

  1. This helped me out after so much frustration! Thanks a lot!!

    ReplyDelete
  2. Typical Microsoft. Too arrogant to admit this is a bug. Seriously, who would leave a title out of a web part "by design".

    ReplyDelete
  3. well, skin cancer incidence would be increasing because of the hole on the ozone layer~ website design companies in johannesburg

    ReplyDelete
  4. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.
    software development company in delhi

    ReplyDelete
  5. Throughout the great scheme of things you receive an A with regard to effort. Where exactly you misplaced me was in the particulars. As people say, details make or break the argument.. And it could not be more correct here. Having said that, allow me inform you just what did give good results. The writing can be highly convincing which is possibly the reason why I am making the effort in order to opine. I do not make it a regular habit of doing that. Next, whilst I can easily notice a jumps in reason you come up with, I am not confident of how you appear to unite the points which in turn help to make your final result. For now I shall yield to your issue however trust in the foreseeable future you link your facts much better. How to find mobile app developers

    ReplyDelete