共用方式為


Search SharePoint from the Internet Explorer Toolbar Using a Custom Search Provider

Here is an easy way to search a SharePoint site from the IE toolbar without having to develop a custom add-in.  Before showing you how to implement it, let's examine how custom search providers work.

How Custom Search Providers Work

When you browse to an Open Search enabled site in IE 7, the search provider drop down lights up

Provider Light Up

You can use a search provider temporarily while on the site (the yellow star indicates it's temporary), or permanently add it to your list of search providers

Temporary Search Provider

To temporarily use a search provider, click the provider name and the search box will change

Temporary Search Provider

To permanently add a search provider, click Add Search Providers and select the provider name

Add Search Provider

A confirmation dialog appears

Confirmation

After that, your custom search provider will remain in the list (note there is no yellow star) no matter which site you are currently on

Search Provider

When the users searches from the search box, they are taken to the SharePoint search results page

Search Results 

How to Implement A Custom Search Provider in SharePoint

To implement a custom search provider, create an XML file that describes it and place a link to the file on the site home page. 

Let's create the search provider XML file.  The XML is self-explanatory, with the key element being the Url.  There is a special token: {searchTerms} that will be replaced with the text the user types in the search box.  Note that the Url is absolute and will be different if you are using the MOSS Search Center (searchcenter/Pages/Results.aspx?k={searchTerms})

Search Provider XML

Upload the XML file to the Shared Documents library

image

Place a link tag in the home page of your site.  You can put it anywhere in the page, but put it in the <head> element if possible.  The simplest approach is to use a Content Editor web part with the Chrome Type set to None

image 

That's all there is to it!

 

Summary

As you can see, implementing a custom search provider for SharePoint is simpler than a single-colored Rubix Cube.  If you would like to learn more about Open Search, the full specifications are available here: https://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_description_document.

Comments

  • Anonymous
    July 08, 2008
    PingBack from http://blog.a-foton.ru/2008/07/search-sharepoint-from-the-internet-explorer-toolbar-using-a-custom-search-provider/

  • Anonymous
    August 04, 2008
    The comment has been removed

  • Anonymous
    August 07, 2008
    I solved my own problem and thought it worthwhile enough to follow up on. I created a simple HTML page on my hard drive that contained the link href to the opensearch xml document.  I was trying to add the search provider from this file.  Using a local HTML file is fine for informing IE about a search provider, but apparently the XML search provider descriptor document has some restrictions on where it can live... The link href was a network share uri (e.g. of the form href="\servershareopensearchdescription.xml").  Apparently IE does not deal with search provider descriptor documents when done this way.  When I put the xml file on a webserver and modified my local HTML file to link to that via http, I was able to add the search provider. This could be some kind of a security zones problem in IE?  I don't know what's going on behind the scenes when a search provider is added, so I have no idea what permission IE needs.  Seems interesting, though.

  • Anonymous
    May 11, 2014
    Does not work with IE9 and SharePoint 2010.