Adding Code To Every Page In SharePoint

If you want to add code to every page in SharePoint (well, almost, see below for details), you should create a Feature Control element with an ID of "AdditionalPageHead".  The delegate control that this is declared for is in the default master page (within the HEAD element) and is declared with the multiple controls attribute so you won't affect anyone else's custom development by using it.

This resolves many development problems like adding Custom_AddDocLibMenuItems that can be accessed from anywhere (allowing you to have a custom EditControlBlock on any page which is a challenge!).

For me this solves quite a few problems, I hope this proves useful for you too.

[UPDATE]

This delegate control does not exist in the additional master pages provided with the publishing features, like blueband.master, etc. but from what I have seen and gathered from others, these are rarely used – if anyone has any additional input on this (customer experience, etc), a comment would be appreciated.

Leave a Reply