다음을 통해 공유


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

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/Header.jpg** **

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

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/UserControl.jpg 

Now our Solution Explorer looks as follows,

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/Solution%20Explorer.jpg

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

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/User%20Control.jpg

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

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/Code%20snippet.jpg

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

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/Empty%20element.jpg

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,

http://csharpcorner.mindcrackerinc.netdna-cdn.com/UploadFile/sagarp/implement-custom-suitebarbranding-delegate-control-in-sharep/Images/final%20Outcome.jpg