In SharePoint 2013 you can run into this issue: The top left corner of pages does not reflect changes to the ‘SuiteBarBrandingElementHtml’ Web Application property or is empty instead of showing default ‘SharePoint’ text.
In this article I’ll explain why this can be the case and how you can resolve or prevent it.
The ‘SharePoint’ text in the top left corner of an OOTB SharePoint 2013 site is actually the result of a new SharePoint 2013 delegate control in the master page:
This control is part of a new set of delegate controls in SharePoint 2013.
A more detailed description of these controls can be found at SharePoint Programming.
The SuiteBarBrandingDelegate control is actually rendering the contents of a web application property called ‘SuiteBarBrandingElementHtml’ and can be updated by using PowerShell.
Some articles that describe this process can be found at Adventures of an Oregon K12 IT Director and at SharePoint Adam.
A simple example of this script would look like this:
$webApp = Get-SPWebApplication "http://mywebapplication.sharepoint.com"
$webApp.SuiteBarBrandingElementHtml = '<a href="/">My SharePoint Site</a>'
Recently I tried to use this feature at a client to customize the default ‘SharePoint’ text, however none of my changes to the ‘SuiteBarBrandingElementHtml’ property had any effect and the site kept showing the default text.
After some research on the web, I found that some users were experiencing the same issue and in certain cases SharePoint was not even showing the default text but just a blank area.
So I decided to look at the Microsoft code for the SuiteBarBrandingDelegate control and it turns out to be a very simple WebControl with just a Render override method.
In this method the code uses a SPWebApplication context and if it exists, it renders the value of the SuiteBarBrandingElementHtml property and if it is ‘null’ it does nothing (result=empty html).
The way it tries to locate the correct web application works like this:
- First the code gets the current IIS Web Site name from the context that it is running in by requesting the System.Web.Hosting.HostingEnvironment.SiteName.
- Then it loops through all the web applications that are configured in the Farm and if one matches the SiteName, it uses that web application to get to the SuiteBarBrandingElementHtml property.
At first glance this seems like a valid way to do it however if
- your web application is not running on port 80
- and you are accessing that web application by using an http URL without a specific port number (=port 80) that you configured as an alternate access mapping
- and you did not specifically bind that website in IIS to that domain name on port 80
- and you have another SharePoint web application that is actually running on port 80 (with a generic port 80 binding in IIS)
It turns out that the HostingEnvironment context – from an IIS point of view – is actually the other website running on port 80 although SharePoint is showing the correct site due to your alternate access mapping configuration.
This means that in this situation, the web application that is found is actually the wrong one so the SuiteBarBrandingElementHtml property that is used is not coming from the correct web application.
It gets worse if the SiteName of the other web application that is used can no longer be found in the SharePoint Farm (because you deleted the web application in central admin without deleting the IIS web site or because the IIS web site was renamed).
In this case your SharePoint site will still work through the configured alternate access mapping but the code which tried to get to the SuiteBarBrandingElementHtml property will be unable to find any web application so it will render nothing at all.
To get this issue solved you have to make sure that you create an IIS binding for your domain name on port 80 for the web site that is using a different port than port 80:
- Open IIS
- On the left-hand panel open your server, then Sites
- Right click on the site for which you want to change the bindings and select ‘Edit Bindings’
- Click Add
- IP Address=’All Assigned’ or specific IP
- Hostname=hostname for your webapplication e.g. www.contoso.com
- Confirm the changes
And that’s all.