SharePoint 4 Developers

Additional reference guide in .NET / SharePoint Development

Speaking at SPUG Auckland

In this session check how to leverage the SharePoint App Architecture by using Single Page Apps. You will get familiarised with the concept, pros, cons and javascript frameworks that make it possible. Your Justice League superheroes will be there, hope you can join us too.

Hi guys,

I am speaking at the SharePoint User Group Auckland on May 20th about "Leveraging SharePoint Single Page Apps".

In this session check how to leverage the SharePoint App Architecture by using Single Page Apps. 

You will get familiarised with the concept, pros, cons and javascript frameworks that make it possible. Your Justice League superheroes will be there, hope you can join us too.

More details, find here: http://www.meetup.com/Auckland-SharePoint-User-Group/events/179945782/

Cheers,

Marcel Medina

Click here to read the same content in Portuguese.

SocialCommentControl - html5 bug

This is a workaround to get the SocialCommentControl to work with Html5 in SharePoint 2013. The problem lies on a html div tag. In Html 5 self-closing tags don’t work, but this control uses it. Check how to fix it.

Hi everyone,

Nice to be back sharing my experiences with SharePoint 2013. It is been some time since my last post, this time I am posting a workaround to get the SocialCommentControl to work with Html5.

In SP2013 this control is deprecated, so I believe that’s why nothing was done to it. Once you add it to a page layout it breaks the markup.

I am talking about the control, so if you are using the SocialCommentWebpart the behaviour is the same, as it wraps up the control with webpart properties.

Googling this didn’t help, so I decided to reverse engineer the SharePoint assemblies and check the implementation. The problem lies on a html div tag. In Html 5 self-closing tags don’t work, but this control uses it, as below:

Code Snippet
  1. protected override void CreateChildControls()
  2. {
  3.     base.CreateChildControls();
  4.     if (!this.IsUPAEnabled)
  5.     {
  6.         string text = SPHttpUtility.HtmlEncode(StringResourceManager.GetString(LocStringId.SocialComment_NeedAuthenticatedMessage));
  7.         text = string.Format(CultureInfo.InvariantCulture, "<span>{0}</span>", new object[]
  8.         {
  9.             text
  10.         });
  11.         this.Controls.Add(new LiteralControl(text));
  12.         return;
  13.     }
  14.     this.Controls.Add(new LiteralControl("<div class=\"ms-socialCommentContents\" id=\"" + this.RootElementId + "\">"));
  15.     if (this.IsShowNewArea)
  16.     {
  17.         this.RenderNewArea();
  18.     }
  19.     this.RenderEditArea();
  20.     this.RenderErrorArea();
  21.     this.RenderPagingControlContainer();
  22.     this.Controls.Add(new LiteralControl("<div id=\"" + this.ClientID + "_PlaceHolder\" />"));
  23.     this.Controls.Add(new LiteralControl("</div>"));
  24. }

Line 14 displays the problem. The tag div is self-closed, which doesn’t work in html 5.

The solution for this is simple. Because there is no closing tag, by adding a div closing tag does the trick.

Create a new class, inherit from SocialCommentControl and override the method CreateChildControls() by adding this closing tag. As below:

Code Snippet
  1. public class SocialCommentHtml5Control : SocialCommentControl
  2. {
  3.     protected override void CreateChildControls()
  4.     {
  5.         base.CreateChildControls();
  6.         this.Controls.Add((Control)new LiteralControl("</div>"));
  7.     }
  8. }

That’s it. Add it to your page layout and use it on SP2013.

I hope it helps.

Cheers,

Reference:
Microsoft Forum

Click here to read the same content in Portuguese.

Rename the Search service application databases in SharePoint 2013

If you are looking at this article: http://technet.microsoft.com/en-us/library/jj219654.aspx to rename the search service application databases, be aware that the approach does not work for some databases. Here it is the workaround.

Hi folks,

If you are looking at this article: http://technet.microsoft.com/en-us/library/jj219654.aspxto rename the search service application databases, be aware that the following approach does not work:

 
To rename the databases by using SQL Server Management Studio
  1. In Management Studio, connect to the source SQL Server instance, and then expand Databases.

  2. Right-click the Search service application database that you want to rename, click Rename, and then type the new name. Repeat this step for each database that you want to rename.

Note: This is not correct for all databases!

This approach only works for the AnalyticsReporting database!

Here it is the trickiest part that is not explained in the article:

If you want to rename the Crawl and Links databases, backup each of these databases and restore them with the new names.

Then you can proceed with the article. Be aware that there are typos with the code snippets provided, as I mention here.

I hope it helps,

Cheers,

Marcel Medina

Click here to read the same content in Portuguese.