1

i customized the OSearchBasicFeature inside 14/template/features/ to have a pretty search-box. Since i want to customize my SharePoint only through deploying a package i was wondering how i'm able to add this feature to my VS Solution?

Naively thought i wanted to add this feature under the feature tab inside my solution but i couldn't find the suitable context.

Tips how to include it that the feature gets activated with the whole skin & master for my custom SP design?

kind regards,

Peter

2 Answers 2

2

You should create a new UserControl if needed and put that inside CONTROLTEMPLATES using a mapped folder

Then you should create a new feature based on Empty Element with a copy of the Control element from OSearchBasicFeature\SearchArea.xml with your changes and give it a lower Sequence than 50

3
  • could be a little more specific i don't know why i would need to implement a usercontrol?
    – Peter
    Commented Mar 20, 2012 at 13:35
  • 1
    That depends on how much you want to customize the SearchBox. If you only need to change the Control element the skip the first paragraph in my answer Commented Mar 20, 2012 at 13:37
  • i found this blogpost for it: fivenumber.com/understanding-sharepoint-delegate-control - in the end this made it really clear for me since i was a little bit confused by "create new feature based on empty element". basically you just need to create a new element in your existing solution and edit it the way like the link describes it
    – Peter
    Commented Mar 23, 2012 at 13:00
1

What search box gets rendered depends on the search settings for the site collection (ie: with scope dropdowns or without). If you want to standardize the style of the search box, you'll also have to standardize that configuration, or make sure you rebrand both search controls.

While it's not a best practice (as they can be changed by Service Packs or CUs), you shouldn't edit the out of the box control templates. In some scenarios (like changing the help icon or other 14 hive icons), that's the only way I know how to do it. Map the applicable folder in your Visual Studio solution and push your own, rebranded copy of the file as part of your activation code.

In scenarios where you have to do this, I like to also store an original of the OOTB file in my solution, and set deactivate code to revert back to the original. This way if a solution is deactivated and retracted, you're back to OOTB SharePoint.

One other important thing to note, is that once you change that feature, control template, or 14 hive asset, you're now going to affect everything on the environment. You either need to duplicate/create your own version, or find another approach if you want to have sites where that search box doesn't look the same.

As an example, extranet branding is typically a little (or drastically) different from intranet branding. If you were to spin up a new extranet site and you've overridden the native search feature styling, that new extranet site will be forced to use the same.

I guess the first question is what changes have you made to make it "pretty" that you couldn't have done via CSS, or a custom control template vs. modifying the OOTB search feature.

3
  • my customized feature works already as wished! i created a copy of the OSearchBacisFeature and changed some reference paths for my custom search-image.. now i want to add this copied and customized feature into my VS so it is accordingly deployed and actived when the package is installed..
    – Peter
    Commented Mar 20, 2012 at 12:33
  • i also could active and deactive that feature via powershell and it works as assumed. the only thing is how i can add this in my solution so i don't have to do it manually when the solution is deployed..
    – Peter
    Commented Mar 20, 2012 at 12:34
  • 1
    If your feature has WebApplication scope that should happen automatically unless you've set ActivateOnDefault to false. Commented Mar 20, 2012 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.