Skip to main content
Go Search

Ayman El-Hattab's Blog [MVP]

Home
Ayman El-Hattab's Blog
Marwan Tarek's Blog
Mohamed Yehia's Blog
  

SharePoint 4 Arabs - Online SharePoint Training, Video Tutorials and Webcasts in Arabic > Ayman El-Hattab's Blog [MVP] > Categories
Finally, SharePoint 2013 Unleashed Hits The Shelves!

mybook

This is just a quick note to let you know that my second book as a Contributor Author (SharePoint 2013 Unleashed) has been finally released.

image 

I’d like to thank the main authors of the book (Michael Noel and Colin Spence) as well as all the contributor authors for their huge efforts. I’m really glad to be part if the team behind this book.

Here is the list of the contributors :

image

You can buy the book from here.

“SharePoint Troubleshooting” , A new free bonus issue of Understanding SharePoint Journal written by Me!

Just a quick note to let you know that a new free bonus issue of “Understanding SharePoint Journal” was released a couple of hours ago. The issue is titled “SharePoint Troubleshooting” and is written by me.

In that 25-page bonus issue, I will introduce you to some of the troubleshooting utilities, tools, tips, and tricks that can make your life easier in view of the fact that SharePoint troubleshooting can really be a nightmare for those who are new to the platform if it is not performed properly. The initiative for this issue came out of my late nights as a software engineer trying to troubleshoot SharePoint solutions to ship high-quality products on time.

image

You can get the issue for free from here.  I’ll also be waiting for your feedback for the issue at ayman.elhattab@gmail.com .

Creating mailing lists for SharePoint sites and blogs [No Code Required]

A few days ago my first article for EndUserSharePoint.com went live. This article is the first one of a series titled “Creating mailing lists for SharePoint sites and blogs [No Code Required]”. You can always follow my articles at EUSP by selecting my name from the drop down list shown at the top of the home page as illustrated in the figure below.

image

Simplifying SharePoint debugging by creating the troubleshooting toolbox!
This is the title of my first article for http://www.sharepointmagazine.net/ where I introduce some of the troubleshooting utilities and tools that can really make a SharePoint developer's life easier since troubleshooting can really be a nightmare for those who are new to the sharepoint platform.
Waiting for your feedback :)
http://sharepointmagazine.net/technical/development/getting-started-with-sharepoint-programming-simplifying-sharepoint-debugging-by-creating-the-troubleshooting-toolbox
SharePoint Delegate Controls Unclouded

Introduction

Over the past few months I have been working on branding the SharePoint portal of one of the largest international companies. This was really interesting especially that this was the first branding experience for me. While I was looking at the OOB master page ( default.master ), I noticed there is a control called “delegate control” in the head element right below the “PlaceHolderAdditionalPageHead”. After googling and investigating, I can say that Delegate Control is one of the most important features of SharePoint 2007 when it comes to branding and customization.

History

Back to 2003, When Microsoft released Microsoft SharePoint portal server 2003, it was cool but what extremely annoyed the developers then is the non-extensibility of the product and the difficulty of customization. Now, MOSS 2007 offers many extension points to alter sites even after they have been provisioned. The introduction of SharePoint features has opened up an entire world to modifying master pages, page layouts and the pages themselves. Further, SharePoint introduced Delegate Controls that allow for more granular control over parts of the page.

Why are they cool and handy ?

On every SharePoint deployment I have ever participated in, it has been requested that the Search Box be modified. In previous SharePoint versions, this involved either unghosting and customization and/or creating a whole new site definition. NOW, Thanks to Delegate Controls, you can take any control and place them on a SharePoint page such that they substitute the existing control at whatever scope you desire and yet require no extra coding or redeployment of the pages themselves. They work hand-in-hand with the newly introduced Features Framework to dynamically load a control at runtime based on a key value and sequence number

Enough Theory, How do they work ?

The default.master file that the global site definition deploys contains some Delegate Controls with the following Id values :

  • AdditionalPageHead
  • GlobalSiteLink0
  • SmallSearchInputBox
  • PublishingConsole

For instance, SmallSearchBox displays a search area and the DelegateControl Definition in default.master is :

<SharePoint:DelegateControl runat=”server” ControlId=” SmallSearchBox”>

All versions of SharePoint contain a feature called ContentLightUp that includes a Control element that specifies a control for the DelegateControl with the SmallSearchArea ControlId value. The element looks like this :

<Control Id=”SmallSearchInputBox” Sequence=”100” ControlSrc=”~/_controltempaltes/searcharea.ascx” />

The enterprise version of MOSS contains a feature named OSearchEnhancedFeature that substitutes the searcharea.ascx user control with SearchBoxEx web control that sends the user to the more advanced search page in MOSS.

<Control Id="SmallSearchInputBox" Sequence="50" ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c">

When SharePoint selects the control to replace the delegate control, it looks through the list of activated controls and selects the best control and the best control is defined as the one that has the lowest sequence number. Because the control element in OSearchEnhancedFeature has a lower sequence number, the control it defines is loaded instead of the one determined in ContentLightup and this occurs without modifying default.master .

There are other DelegateControls, like AdditionalPageHead, that do not have visual elements but instead provide the ability to insert additional HTML at runtime.

For example, I once created a web control called SearchEngineOptimizer that emited META tags ( Meta Tags are html tags that appear in the head of html pages) for search engine optimization and created a feature to load that web control!

Well, there is a couple of tips and recommendations that I want to highlight :

  • By using a feature scoped at web, you can use different search boxes for different areas in your site collection with no extra code.
  • You can load user or server controls, if you are specifying a user control, use URL attribute, if you want to load a server control use ControlClass and ControlAssembly attributes.
  • By adding AllowMultiple=true in to the delegate control declaration, you can make it load more than one user/server controls. ( for instance AdditionalPageHead delegate control is set to allow multiple controls by default).
  • When designing your page, create delegate controls for functionality that might change over time.
  • Keep tack of the sequence and don’t use too low numbers. You don’t want to have trouble overriding the feature in the future.

Summary

Delegate Controls are important design options for creating solutions that can mixed and matched with other options. The ability to light up functionality for one site and not another can be a very important tool in the SharePoint developer’s toolbox.