Question

I am using sp 2013. I would like to create a delegate control to be visible in the masterpage of the mysites. I do not want to edit the masterpage because it needs to stay OOTB. I would like to use the existing placeholder "AdditionalPageHead". How does this work?

Était-ce utile?

La solution

Here is the simplest step-by step guide.

You only need to create feature that will specify, what to put into AdditionalPageHead placeholder. This feature then could be activated(installed) in the any site (mysites site as well).

Autres conseils

You simpy have to define a Control inside your element file and specify "AdditionalPageHead" as the Control Id.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control  Id="AdditionalPageHead"
    Sequence="1001"
    ControlAssembly="fully qualified assembly name"
    ControlClass="namespace qualified name of the control class"/>
</Elements>

in the above sample, I specify the control assembly and class. This is useful when your control is code-only. If you have a file instead you could use

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control  Id="AdditionalPageHead"
    Sequence="1001"
    ControlSrc="control virtual path"/>
</Elements>

Notice that in this specific case the sequence number is almost useles. Normally, the parameter would define a priority between multiple delegate controls that target the same zone for zones that allow only one control: the lowest sequence id wins. Since you are targeting the "AdditionalPageHead" zone this is mostly ignored since you can add multiple control to that zone.

Also notice that depending on how you created the control to add, you may have to define a safe control entry for it since Visual Studio may not create it for you automagically.

Anyway, this page on msdn provide a step by step guide to get you started. It refers to SharePoint 2010, but the feature wasn't changed in 2013 so you can safely refer to it. Fell free to

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top