Using Delegate Controls In SharePoint

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    Introduction,Hi, My name is X I am Y at KWizCom.As an ISV, the nature of our work is to focus on easy deployment of our solutions at the customer’s end.When we want to extend a feature of SharePoint most of the time our customers just run an installer and our product should fit in their environment with as little customization as possible.This is why we need to take advantage of every possible integration option we can get our hands on.Today we are going to talk about one of the less common of these options – Delegate controls.

    If you been around SharePoint long enough, the first thing you did is play with some web parts.They allow you to add web components to your pages in run time, without a need for coding or designing your pages.You can customize them via web part properties, and even add web part connections for more advanced results.Some of the limitation are that everything must be done in a page level.Also – you can only add web parts where you have web part zones, so the page structure cannot be modified – sometimes we want that important capability, if we do not wish our content editors to break our UI design and basic page structure.Speaking of which, content editors can be given edit pages permissions. you cannot control the web parts they can add, their configuration, connections etc.

    Advantage: Content editor can choose from limited options thus cannot break the site’s design concept / integrity. Important for WCM public sites.What does “Static templates” mean?if I want to change the content (replace controls/ change properties of controls) I must update the .aspx page.If I want to change the page’s behaviour according to site for example, I will have to deploy different master page/layout per-site or develop a “smart” control that identifies the current site and changes it behaviour accordingly (according to my custom logic: static list of url’s, features, site name etc. – Not ideal)

    Change master pages

    Change layouts

    Another level of page content customization, like web parts, master and layout pages.It is basically a control place holder that allows you to change it’s content based on a feature logic.So you will be able to use the same master page and layout page and still change the page content based on specific logic – feature – without having to code or modify any of these page.

    So, going back to our advantages / limitation slide we can see that using a delegate control allows us to support some sort of logic in the controls we want to add, to a specific scope. The control will be registered AND unregistered automatically based on the feature The problem here is that you have to target existing place holder controls – delegate controls – that are already in the page. You can target one of SharePoint’s OOB delegate control or create your own.Say you wish to add a link to your project management system, and you want that link to only appear inside project web sites. You could create a delegate control called “ExternalSystemLink” and create a feature that registers “Link to project Mgmt System” only within project sites.This way, in the future you will be able to do the same withing support sites, sales sites and all based on feature logic instead of hand coding everything into the link control itself.Another issue is that the delegate control usually only loads the highest priority (lowest value) control and another control may override your control without you knowing about it.

    Change layouts

    Change layouts

    Change layouts

    Scope – optional. Limit the search for controls in features at the same scope only.Farm, Web Application, Site Collection, Web Site.AllowMultipleControls – optional.

    Loading Logic will be separated from the controlsYou can have a generic navigation control, search control that are not aware to your custom loading logicCentralize your loading logic in one place: Feature, or a settings page.

    Favorites, Groups & Events

    Using Delegate Controls In SharePoint - Presentation Transcript

    1. ShaiPetel
      MCTS, MCT
      VP R&D – KWizCom
      shai@kwizcom.com
      Delegate Controls - What, Where & How
    2. KWizCom Business Card
      • Founded in 2005
      • Headquartered in Toronto
      • Global provider of add-ons and services
      • 3000+ customers worldwide
      Business Target:Deliver innovative and cost-effective add-ons, enabling customers to deploy excellent Microsoft SharePoint, Dynamics CRM and Project server solutions, faster than ever and at no risk.
      Fields of expertise:
      • Microsoft Office SharePoint
      • Microsoft Dynamics CRM
      Competencies:
      Gold Certified Partner
      • ISV
      • Information Worker
    3. Topics
      • Review different SharePoint pages customization options
      • What’s a “Delegate Control”?
      • Why should I use it?
      • Where can I find them?
      • How do I start working with Delegate Controls?
    4. Customize SharePoint pagesWeb parts
      SharePoint 101… Add web parts
      • Advantages
      • Done in run-time by non-technical content manager
      • Flexible and customizable by user via web part properties
      • Limitation
      Per-page operation (add, modify, remove)
      Cannot change page structure, only add/remove web parts
      Cannot moderate options (allow/deny only)
    5. Customize SharePoint pagesWeb parts
    6. Customize SharePoint pagesMaster / Layout Pages
      Master pages, Page Layouts
      • Advantages
      • Easily define pages design structure (and base content)
      • Provide templates which enables easy changing
      • Limit choices to several approved predefined option
      • Limitation
      Static set of templates
      Cannot target content based on logic, need to manually develop logic or create several master / layout pages
    7. Customize SharePoint pagesMaster / Layout Pages
    8. Customize SharePoint pagesMaster / Layout Pages
    9. What is a Delegate Control
      A Delegate Control is:
      • Another level of encapsulation
      • Control “place holder”
      • Enables run-time binding between a page and actual hosted controls
      • Built in support for logic – loading based on features
      • Enables making changes in your provisioned sites without having to recode your site pages!
    10. Why use Delegate Controls?
      Delegate Controls
      • Advantages
      • Support logic for loading controls
      • Automatic deploy to specific scope (Farm, Web Application, Site Collection, Web Site)
      • Control will unregister once it’s feature is deactivated
      • Limitation
      Only targets a pre-defined place holder in the master page
      Can be overridden by other features with higher priority (lower value) unintentionally
    11. Where can I find Delegate Controls?
      Delegate controls in default.master:
      AdditionalPageHead (Allows multiple controls!)
      GlobalSiteLink0, GlobalSiteLink1, GlobalSiteLink2
      SmallSearchInputBox
      TopNavigationDataSource
      PublishingConsole
      QuickLaunchDataSource
    12. Delegate Controls in Features
    13. Examples of build in controlsCustom logic!
    14. Examples of build in controlsCustom logic!
    15. Examples of build in controlsFeature logic!
    16. How do I start working with Delegate Controls?
      Its as easy as 1,2,3!
      Add a delegate control to your page
      Create a candidate control
      Register your candidate to the delegate using a feature!
    17. Delegate ControlDeclaration on page / master
      Registering a new control named “MyTargetedControl” :
      <SharePoint:DelegateControlrunat="server“ ControlId="MyTargetedControl" Scope="Site Collection" AllowMultipleControls="false"/>
      Note: The scope attribute indicates where SharePoint will look for possible candidates. It must match the scope of the feature registering the controls
      Note: Setting the AllowMultipleControls property to true causes all matching candidate controls to be added to the page as children of the delegate control according to the order specified by the Sequence attribute.
    18. Delegate ControlRegistration Via feature
      Registering a user control:
      <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Control Id="MyTargetedControl" Sequence="90" ControlSrc="~/_ControlTemplates/SayHello.ascx">
      <Property Name="ImageSrc">/_layouts/images/gosearch.gif</Property>
      </Control>
      </Elements>
      Registering a custom control:
      <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Control Id="MyTargetedControl " Sequence="80"
      ControlClass= "Company.Product.ControlClass" ControlAssembly= "Company.Product, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXX">
      <Property Name="ImageSrc">/_layouts/images/gosearch.gif</Property>
      </Control>
      </Elements>
    19. So, Why should I use it?
      Now you can:
      • Easily override existing SharePoint controls without any need to update provisioned sites/pages!(Example: replace SharePoint’s search box with your own custom search box)
      • Implement a master page that behaves differently in different sites, based on features.
    20. Questions
      Questions before live demo?
    21. Hands-on examples
      Live demo:
      • Feature that registers delegate control
      • Activating / Deactivating
    22. It all comes together...
    23. More information online
      Delegate Control description http://msdn.microsoft.com/en-us/library/ms463169.aspx
      How to: Customize a Delegate Control http://msdn.microsoft.com/en-us/library/ms470880.aspx
    24. Questions

    + KWizCom TeamKWizCom Team, 5 months ago

    custom

    491 views, 0 favs, 2 embeds more stats

    The why, where and how of delegate controls for Sha more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 491
      • 460 on SlideShare
      • 31 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds
    • 30 views on http://kwizcom.blogspot.com
    • 1 views on http://www.naymz.com

    more

    All embeds
    • 30 views on http://kwizcom.blogspot.com
    • 1 views on http://www.naymz.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories