Saturday, 1 August 2020

Implement Custom SuiteBarBranding Delegate Control In SharePoint 2013

Introduction

In this article we will see how to implement SuiteBarBranding Delegate Control.

SuiteBarBrandingDelegate: This delegate care about top left site logo and text. Facilitates us to override the left-top corner text for the site. This text can only be replaced by overriding SuiteBarBrandingDelegate Delegate Control with custom control created using Visual Studio. Normally, there’s a text reading "SharePoint", so we can replace it with the title of our own site:

SuiteBarBrandingDelegate Control will look as follows in SharePoint Page.

Header before

Header

Step 1: Create one empty SharePoint Project and provide the Solution Name and choose the Solution Path. Then click OK.

Step 2:
 Deploy the Solution as Farm Solution. Provide the Url in next screen and validate the connection.

Step 3: Add New UserControl to the Project from the Templates and provide a Name to it. In our case it is “MyCustomSuiteBarBrandingDelegate

UserControl

Now our Solution Explorer looks as follows,

Solution Explorer

Step 4: Now open the “.ascx” of the User Control and paste the following code.

User Control

Step 5: Code snippet for the ascx.cs file.

Code snippet

Step 6: Add Elements.xml file to the Solution, provide the name and click  Add.

Empty element

Step 7: Click on elements.xml file and paste the following code snippet inside the elements tag.

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
  3.   <!-- Adding DelegateControl reference to our custom SuiteBarBrandingDelegate Control -->  
  4.   <Control ControlSrc="/_controltemplates/15/SuiteBarBrandingDelegate_Example\MyCustomSuiteBarBrandingDelegate.ascx"  
  5.            Id="SuiteBarBrandingDelegate"  
  6.            Sequence="1" />  
  7. </Elements>  
Step 8: Final step is build and deploy then the SharePoint text will be overridden with the text of the portal.

The final outcome will be as in the following screenshot,

final Outcome

No comments:

Post a Comment

SharePoint 2013 - Uploading Multiple Attachments To The New Item On List Using JSOM And REST API

  Introduction In this article, we will explore how we can attach multiple attachments to the new item on list using JSOM and REST API. Ther...