Mark Wagner's .NET C# Cogitation

.NET Architect and Developer - Simple Thoughts from a Simple Mind

  Home :: Contact :: Syndication  :: Login
  90 Posts :: 59 Articles :: 1548 Comments :: 187 Trackbacks

News

You can download this .TEXT blog skin free. Download Cogitation Blue skin.
Updated May 6, 2004

My Sites
- New SharePoint Blog
- My Developer blog
- My Personal blog
ASP.NET Web Hosting
I host my site here. The best value for quality hosting. Read my opinion here. If you decide to join, please use this link. Thank you very much.


Legal
Any and all code, software, examples, suggestions and anything else on this web site is available for you to use at your own risk. No warranty is express or implied.
Views and Opinions
Mark Wagner works for Microsoft in the Consulting Services division and covers the West Region. The views and opinions expressed on this web site are not necessarily the views or opinions of his employer.

Article Categories

Archives

Post Categories

.: Architecture Links :.

.: Developer Links :.

.Text and RSS Links

Blog Roll - Top Guns

Developer: .NET Security

Developer: C# Team

Developer: Flash

Developer: JavaScript

Developer: Pocket PC

Personal: Aviation

Personal: Favorites

Google Search Web Part

Mark Wagner
http://blogs.crsw.com/mark
June 10, 2005

Article: http://blogs.crsw.com/mark/articles/1009.aspx

Update: June 20, 2005
For those of you who need assistance with installing this web part, you can use my Web Part Package Installer program.  This installer program makes installing a web part package very easy.

Downloads
I have provided two downloads. 
 Google Search Web Part Package
 Google Search Web Part Source Code

I created a custom Google web part a few weeks ago for my demo SharePoint site.  You can see what it looks like on my testing SharePoint home page http://sharepoint.crsw.com.  The Google web part submits a search request by navigating the user directly to the Google search web page and performs a Google search using the Google search engine.  I have since received a number of emails requesting to get this web part for use on their SharePoint sites.

First and foremost, the Google name and search service are the property of Google.  I have no affiliation with the Google name and its services.

Google is a must-have resource for my daily work.  If I need to find something, I Google it, and nothing else comes close when searching on the Internet.  With this dependency, I had to have it on my new SharePoint demo site.  My SharePoint demo site is more of a test-harness at this point since it is hosted on a shared/public server, so don’t be too disappointed when you see it.

For those of you not familiar with Google, welcome to the Internet.  Google is the single best Internet search service available on the Internet, for the Internet.  If you need to find something on the Internet, Google will find it for you.  This process of searching is commonly referred to Googling.  If you Google something, your are using Google to search the Internet for it.  For the rest of you, Google is probably how you found this article.

It is important to remember that this Google Search web part is not intended to replace the SharePoint search feature.  In order for Google to find any results, Google must have already searched and indexed your site.  Also remember that Google will not be able to crawl and index pages on your SharePoint site that are not accessible to the public.  This is where the SharePoint search has the upper hand.  Again, this web part is not intended to replace the SharePoint search feature, but to conveniently access the much used Google search from your SharePoint page.

Configuring the Google Search Web Part

Here is a picture of the web part configurations.

Google Image URL

Once you have installed the web part, in the configuration options of the web part is a Google Image URL property which defaults to an image on Google’s web site.  You should use the default url for the Google image.  I have made this property available just in case Google renames or moves their image.

This Google Search Web Part can be configured in three distinct ways.


Standard Google Search

Local Site Search

Custom Site Search

 

Standard Google search
The standard search performs a normal Google search just as if you went to the Google web site and entered your search criteria.

Local Site Search (Using Google)
The local site check box is used to limit the Google search results to return only content that resides within the current site URL.  The local site URL will be displayed in the Google Search Web Part to make this clear to the user.  This allows the Google Web part to use the current site URL as the search scope.  To be clear, the Google search engine is used to search for results for only those web pages that have the same domain as the current page.

Important Note: The Local Site check box may not stay checked.  If this is the case, this is intentionally being unchecked by the web part when you save because the mechanism used to obtain the local site URL is not allowed due to the current security restrictions on SharePoint server.  You will either need to have the server administrator grant the necessary access, or simply not use this option.

Custom Site URL (Using Google)
If you specify a custom URL, the custom URL is used to narrow the Google search results to return only the results that are located on the specified custom site/URL.

About the Downloads

The compiled assembly and web part package have been built with a strong name and therefore can be installed in the GAC if needed.  This also allows for this assembly to be configured and used on SharePoint servers that have tighter security.  If you are unable to compile, or simply wish to use my assembly, you can do so with the confidence knowing the full assembly name (including the version, public token, etc.) will only work with the compiled assembly I have provided in the web part package (.cab) file.

The source code is also available in a separate download; however, I have removed the Strong Name Key file to keep my compiled version secure from any bogus impersonators.  You will need to create your own strong name key file and update the necessary manifest and web part description (.dwp) file to successfully deploy your web part assembly to your SharePoint server.  For those who are interested in how this web part has been written, you can view the source, modify, and build your own Google Search Web Part.

How the Google Search Web Part works

This is a very simple web part.  The entire Google search request is performed using the standard Google search URL along with a couple query string (URL) parameters.

The Google Search URL accepts a number of parameters.  The only two we are concerned with are the search criteria and; optionally the site URL scope.  The search criteria is appended to the URL with the “q=” parameter.  Additionally, the “site=” parameter allows us to optionally narrow the scope the of the search results to the site URL provided.

Here is the base Google Search URL.

http://www.google.com/search

Here we have appended the search criteria to the URL.

http://www.google.com/search?q=mark+wagner+web+part

Finally, we here we have the Google Search URL with the search criteria and the site scope added to the URL.  This will only return results that meet my search criteria AND exist on the blogs.crsw.com/mark site.

http://www.google.com/search?q=web+part+site:blogs.crsw.com/mark

This Google Search Web Part may be used – free.  There is no implied warranty and you use it at your own risk. But how could you not.

Need Help Installing This Web Part?

If you need help installing this web part package, try using my Web Part Package Installer program to make this process easy.

posted on Friday, June 10, 2005 11:56 AM

Feedback

# Googl Such Webpart 6/12/2005 11:44 PM SharePoint, SharePoint and stuff
Mark Wagner hat ein SharePoint Suchwebpart f

# Googl Such Webpart 6/12/2005 11:45 PM SharePoint, SharePoint and stuff
Mark Wagner hat ein SharePoint Suchwebpart f

# re: Google Search Web Part 6/12/2005 11:23 PM Mike Walsh Helsinki
I've added this link to the WSS FAQ sites.

For the benefit of those people reading the article via the link from there, could you also include full (simple) installation instructions in this article.

Most people won't be able to do much with your .cab file.

Mike

# Google Search Web Part 6/13/2005 7:45 AM Alex's blog about SharePoint and .NET


# re: Google Search Web Part 6/13/2005 7:27 AM Mark Wagner
Hi Mike,

I agree with your point on providing some installation instructions. I did intend to do this eventually, and hope to have that added to this article in the next day or so.

Also, thanks for the adding a link to this article on the WSS FAQ site.

Mark

# Updated my list of links: 3rd Party Webparts 6/13/2005 11:28 AM The Boiler Room - SharePoint [MVP]


# re: Google Search Web Part 6/16/2005 1:37 AM John
How do you make the webpart safe?

# re: Google Search Web Part 6/24/2005 6:51 AM Doug
This is sweet. Thanks for sharing this!!

# re: Google Search Web Part 7/5/2005 4:28 PM andrew cameron
thanks,
thisis cool.
and you alsos pointed meto the built in search which is realywhat i was looking for,
but hey now i can have agoogle search as well.
thanks,

# re: Google Search Web Part 7/7/2005 7:02 PM James Feldman
Brilliant! Saves me a lot of time/clicking.
Are you planning a "localisation" option for doing localised Google searches? For instance, being Australian I usually search on google.com.au - this provides more relevant local searches.
It would be great to have an option to change the Base URL to a local google one.
(This is a request on behalf of all those who are not capable of compiling their own from your source code).


# re: Google Search Web Part 7/7/2005 10:41 PM P.E.LAM
Excellent + Brilliant Job.

# re: Google Search Web Part 7/8/2005 7:03 AM Mark Wagner
James, I like your suggestion on allowing the user to define the localized Google search to use.

# re: Google Search Web Part 7/8/2005 7:05 AM Rafael Ruiz
Hey¡ Excellent webpart, I installed with your Web Part Package Installer and it work just fine, EXCEPT for the following error that appears in the page:

Line: 367
Car: 7
Error: ':' Expected

That line, is:

<PartImageSmall />

What is wrong? TKS for your help

# re: Google Search Web Part 7/8/2005 2:02 PM JenH
Help! I downloaded and installed the Google Web Part using your Web Part package installer--everything worked great but I'm not able to open my site in Front Page any more because the web part is not registered as safe.

I wasn't prompted during the install to mark the Google Web Part as safe--how can I mark it as safe so my site opens in Front Page again?



# re: Google Search Web Part 7/12/2005 6:13 AM Miguel
Very cool, thanks.
One question: can you give me a hint on how to get it to open the results window in a separate browser? Recompiling from source.

# re: Google Search Web Part 7/14/2005 8:07 AM JenH
Okay, after adding the following to the web.config file I was able to make this webpart safe for my website:

Assembly="Castle.WebParts.GoogleSearchWebPart"
Namespace="Castle.WebParts.GoogleSearchWebPart"
TypeName="*"
Safe="True"

This is awesome! Thanks a bunch.

# re: Google Search Web Part 7/15/2005 8:37 PM 翻译公司
Namespace="Castle.WebParts.GoogleSearchWebPart"

# re: Google Search Web Part 7/15/2005 8:37 PM 翻译公司
was able to make this webpart safe for my website

# re: error 7/18/2005 9:59 AM travis
Hey,

I have the same problem as Rafael Ruiz does.

The,

Error: ':' Expected

I can't for the life of me work it out.

Does anyone know the problem?

Cheers,
tk

# re: Google Search Web Part 8/8/2005 6:35 AM 翻译公司
Thanks.

# Third Party Free Web Parts and Useful SharePoint Tools 8/17/2005 8:08 AM SharePoint
Found these on a SharePoint blog.&nbsp; There appears to be lots of useful web parts here as well as...

# re: Google Search Web Part 9/15/2005 8:57 AM Ryan Ornelas
How can I modify this to search our internal google mini box?

# re: Google Search Web Part 9/21/2005 12:16 PM Scott Sorensen
I like the search bar but I have one problem I dont have any of the _layouts/images files. There isnt a folder in the structure and I even tried making one and still no luck. Any suggestion?

# re: Google Search Web Part 9/21/2005 2:58 PM Jim
Works great! Any chance we could have the results appear in a new window?

# re: Google Search Web Part 9/22/2005 5:34 AM dayst5
This works great! The only think lacking is opening a new window when the search is submitted!

# re: Google Search Web Part 9/28/2005 3:51 AM Nick Kizirnis
We have set up a custom Google gadget with a dropdown that lets you choose which Google site gets searched (eg., UK, Japan, etc.) ... a way to either pre-select your location or to change it within the gadget would be nifty.

I am looking forward to trying this gadget out ... thank you!!

# re: Google Search Web Part 10/11/2005 9:45 AM JohnP
I'm currently building an intranet site (some sharepoint/some custom) and would like to use the Google search to search the complete site (Sharepoint and all) - Would this webpart be capable of doing that?

Thanks in advance.

# re: Google Search Web Part 10/14/2005 8:05 AM bill
Can i use this to search document librarys becuase i cant get the sharepoint search to wrok fro the life of me

# Sharepoint: Risorse utili 10/14/2005 3:14 PM Romeo Pruno
SharePoint Web Parts (free)

ActiveX Scripting Web Part (Simon Mourier)
Alert Manager, Subweb Viewer...

# I Need Help for uninstalling This Web Part 10/19/2005 10:41 PM Josef B
How can i uninstall the google search webpart.
I used the stsadm.exe for uninstall, but i have one error Message after the uninstall process on the first Portal Site.

# re: Google Search Web Part 11/3/2005 6:09 AM DM
Does anyone know how i can change the default url to google.co.uk from .com? I can't find the correct file. Many thanks.

# re: Google Search Web Part 12/10/2005 12:46 AM Alex
Hello there :)
I'd like to ask you about combination of this webpart and Google Desktop. Is it posible to force Google Desktop to search through SPS?

Thank you in advance

# re: Google Search Web Part 12/19/2005 6:50 AM JasonK
Can someone tell me how to modify my SharePoint Services site or the Google search web part so that I can sheck the "Local Site Search" option and have it be saved?

Mark stated this above: "Important Note: The Local Site check box may not stay checked. If this is the case, this is intentionally being unchecked by the web part when you save because the mechanism used to obtain the local site URL is not allowed due to the current security restrictions on SharePoint server. You will either need to have the server administrator grant the necessary access, or simply not use this option."

But I can't figure out what and where I need to modify thew necessary access. I would really like to try out the "Local Site Search" option. Thanks!

# re: Google Search Web Part 2/8/2006 7:36 AM DavidInArk
I get the "unsafe" error in frontpage, too, but I do not know enough about Sharepoint yet to know what to edit to make it work... I looked in both of my virtual server directories and there is an entry for the web part, with a key and all...

I tried copying JenH's section info and pasted it into the web.config in my 60\bin folder, did iisreset, and still shows as unsafe...

Any help is greatly appreciated!

# re: Google Search Web Part 2/8/2006 4:48 PM aloe vera
good

# re: Google Search Web Part 2/14/2006 10:39 AM Edward S. Ferrara
Hi:

Does this transfer information to Google, if it searches the local site? Also what security considerations should be take to insure confidential company information stays secure if we use this approach?

Thanks.

Ed Ferrara

# re: Google Search Web Part 2/14/2006 11:05 AM Mark Wagner
Hi Edward,

Good question. This Google web part does not transfer any content to Google. It mearly searches the Google database for any content residing in Google's databse for the local site. Meaning, Google will only return results that it has already gathered from your site and that meets the search criteria.

To prevent Google from searching specific content on your site, you need to make sure that the site requires authentication (a login process). Since Google will not have an name and password to access your site, they will not be able to "crawl" your site.

# re: Google Search Web Part 2/19/2006 2:31 PM Malcolm Eaton
Noticed a couple of people asked about this as well, but is there any way to open the results in a new search window?

# re: Google Search Web Part 2/20/2006 1:08 PM Rick
I get this error after removing the web part with stsadm.exe

The Castle.WebParts.GoogleSearchWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37780cc265a3a117 assembly specified in a Register directive of this page could not be found.

Any help would be greatly appreciated

# re: Google Search Web Part 2/21/2006 1:33 AM shanghai computer2
WebParts.GoogleSearchWebPart, Version=1.0.0.0,

# re: Google Search Web Part 2/23/2006 11:02 PM Tom N.
I too would like to open a new window with the results. Seems simple enough, but I am not a Windows programmer and cannot take the source code and generate the CAB file to try it.

I believe changing the source at line 122 would do it, to something like:

output.RenderBeginTag("a target=\"_blank\"");

Can anyone try that, then post back the CAB if it works?

Thanks.

# re: Google Search Web Part 3/15/2006 6:52 AM Peter Lu
I tried to modified the project to left it open new window but still under work.

output.RenderBeginTag("a target=\"_blank\""); doesn't work due to the result was used redirection instead output rendering.



# re: Google Search Web Part 3/16/2006 11:33 AM EQN
Can your webpart be modifed to point to a google appliance URL instead of Google.com?

# re: Google Search Web Part 3/27/2006 9:25 PM Aaron Wagner
Important Note: The Local Site check box may not stay checked. If this is the case, this is intentionally being unchecked by the web part when you save because the mechanism used to obtain the local site URL is not allowed due to the current security restrictions on SharePoint server. You will either need to have the server administrator grant the necessary access, or simply not use this option.

How do I change the security setting so this works?

Thanks,
Aaron

# re: Google Search Web Part 4/11/2006 10:23 AM Simon Collingridge
Great, just what we needed - how about allowing some additional parameters/options so, for example, you could make this web part search Google Images, or Google Books instead?

# re: Google Search Web Part 5/3/2006 6:08 AM Hazel
Excellent! Thankyou

# re: Google Search Web Part 5/4/2006 5:26 AM re-post
Great, just what we needed - how about allowing some additional parameters/options so, for example, you could make this web part search Google Images, or Google Books instead?

# re: Google Search Web Part 5/5/2006 7:24 AM Mark_EM
Hi,
This is agreat solution for sharepoint. I do have a small problem. I installed the google web part with the web part package installer and I have it as a web part on my site, but I search for something within my site. It says that my search does not have any matching documents, but that document is there.
Maybe I am missing something.
Please Help
Thanks

# re: Google Search Web Part 5/18/2006 12:57 AM Pia
I like it!

I have an idea (really a request, but if you say it right... :) to further develop the custom web part. I want to be able to specify a range of websites to search. For instance, I work a lot with a few different newspapers and I would like to gather those in a google search.

It would save me massive amounts of time and clicks if I could have a drop down with these newspapers' url and search them and have the result poop up in a different window. Oh man. That would be heaven.

# re: Google Search Web Part 5/19/2006 3:16 AM Randine Perry
Due to the current security restrictions on SharePoint server?? What restrictions are we speaking of here please??.
You will either need to have the server administrator grant the necessary access!!! What Access please??



# SharePoint Web Parts: Free 3rd Party SharePoint Web Parts &amp; Tools 6/1/2006 1:50 PM The Boiler Room - Mark Kruger, SharePoint MVP
For those who aggregate my feed and do not often visit the blog iteself... I've updated my SharePoint...

# re: Google Search Web Part 6/4/2006 10:59 AM Jason Moore
Has anyone recompiled this to open in a new browser? Any help would be appreciated. Thansk!

# re: Google Search Web Part 7/3/2006 11:20 PM 数据恢复
Can your webpart be modifed to point to a google appliance URL instead of Google.com?

# re: Google Search Web Part 7/5/2006 8:54 PM Google左侧排名
Can your webpart be modifed to point to a google appliance URL instead of Google.com?

# re: Google Search Web Part 7/13/2006 10:36 PM Frank Wells
Another nice feature would be the ability to create a custom global filter that you could use to make the search results exclude certain web pages or web parts within your site etc.

# re: Google Search Web Part 8/2/2006 5:21 PM Dilip Bajaj
Hello,

We are using Latest version of Sharepoint V3.0 & I could import your webpart & added the entries into the web.config file but still it gives me it is not safe. Do you think this version of webpart is compatible with the latest version of Sharepoint ???

Thought of trying it other way round using this installer .MSI but that also gave me error COM object with CSLID is not registered.

Your help is appreciated.

Regards,
Dilip Bajaj

# re: Google Search Web Part 8/9/2006 7:02 AM Mathew
Mark,

Ok, I'm beating my head against the wall here...

All we want to do is have Google added to the SharePoint Portal context search drop down list. The only caveat is that we don't want SPS to try to go out and index Google.

Is this even possible? Or is the only way to get google search into SPS and WSS sites to add a web part of my own?

I've been scouring the news groups and various SP resource sites and all I see is people adding custom web parts to accomodate this functionality.

# re: Google Search Web Part 8/21/2006 7:29 PM Steve Dickson
I want to be able to search the local Intranet and got to this ......

"Important Note: The Local Site check box may not stay checked. If this is the case, this is intentionally being unchecked by the web part when you save because the mechanism used to obtain the local site URL is not allowed due to the current security restrictions on SharePoint server. You will either need to have the server administrator grant the necessary access, or simply not use this option. "

This is exactly what happened to me. If I am logged into the server as the domain administrator and logged into the Intranet as the Sharepoint administrator, how can this possibly happen? Any futher advice of where I look to get this sorted?


# re: Google Search Web Part 8/23/2006 1:07 PM ilya
Don't know if anyone else has done it this way, but here's a Content Editor Web Part script that will extend the existing search scope drop-down box to include Google.



# re: Google Search Web Part 9/9/2006 11:29 PM Boris
i just want to say THANK YOU very MUCH.

would love for the search to open in a new window, but it's still so AWSOME

thanks again

# re: Google Search Web Part 9/21/2006 1:36 AM 成人用品性用品
thanks!!

# re: Google Search Web Part 10/23/2006 6:58 PM 翻译公司
baibai

# re: Google Search Web Part 10/24/2006 6:59 AM SDFSDF
ASDASDASDASD

# re: Google Search Web Part 10/24/2006 7:02 AM 美女网
think

# re: Google Search Web Part 10/26/2006 1:37 AM 数据恢复
ASDASDASDASD

# re: Google Search Web Part 10/26/2006 1:43 AM 数据恢复
AA

# re: Google Search Web Part 10/26/2006 1:44 AM 数据恢复
ADFSD

# re: Google Search Web Part 10/31/2006 3:24 AM 桂林旅游
How can i uninstall the google search webpart.
I used the stsadm.exe for uninstall, but i have one error Message after the uninstall process on the first Portal Site

# re: Google Search Web Part 10/31/2006 3:26 AM 云南旅游
How can i uninstall the google search webpart.
I used the stsadm.exe for uninstall, but i have one error Message after the uninstall process on the first Portal Site

# re: Google Search Web Part 10/31/2006 3:27 AM 数据回复
How can i uninstall the google search webpart.
I used the stsadm.exe for uninstall, but i have one error Message after the uninstall process on the first Portal Site

# re: Google Search Web Part 11/3/2006 7:44 AM Craig
This is great! One question: Is there any way around the authentication issue? I have a portal which requires a login/password. Am I out of luck? --thanks

# re: Google Search Web Part 11/7/2006 6:53 PM Pawan
i have a question that how can we open the search results in the same webpart instead of navigating to google window.

# re: Google Search Web Part 11/8/2006 3:53 PM 数据恢复
have a question that how can we open the search results in the same webpart instead of navigating to google window.



# re: Google Search Web Part 11/8/2006 3:54 PM 数据恢复
have a question that how can we open the search results in the same webpart instead of navigating to google window.







# re: Google Search Web Part 11/8/2006 3:55 PM 数据恢复
have a question that how can we open the search results in the same webpart instead of navigating to google window.











# re: Google Search Web Part 11/13/2006 9:28 AM HC
Did any one get this working for Sharepoint 2007 and WSS 3.0. I'm having trouble getting this to work.

Any help is greatly appreciated.

Thanks,
HC

# re: Google Search Web Part 11/20/2006 4:13 AM 数据恢复
good~

# re: Google Search Web Part 11/21/2006 9:43 PM Roopa
hi

i installed SPS 2.0

created a top level web site

created a sub site using a template

after creating, when I tried to open the subsite in IE, its giving this message


Error

The Castle.WebParts.GoogleSearchWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37780cc265a3a117 assembly specified in a Register directive of this page could not be found.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily disable Web Parts or remove personal settings. For more information, contact your site administrator.

Troubleshoot issues with Windows SharePoint Services.




# re: Google Search Web Part 11/29/2006 8:37 PM U盘
hao are you

# re: Google Search Web Part 11/29/2006 8:42 PM 车载MP3
nice to meet you

# re: Google Search Web Part 11/29/2006 8:48 PM 职业经理人培训
very good

# re: Google Search Web Part 11/30/2006 12:39 AM 上海数据恢复
i installed SPS 2.0

created a top level web site

created a sub site using a template

after creating, when I tried to open the subsite in IE, its giving this messag

# re: Google Search Web Part 12/2/2006 3:50 PM 窃听器
ok

# re: Google Search Web Part 12/4/2006 8:30 AM MP4厂家批发
ok


# re: Google Search Web Part 12/4/2006 8:31 AM 摄像头
good

# re: Google Search Web Part 12/4/2006 8:32 AM 深圳职业经理人培训
good yes

# re: Google Search Web Part 12/4/2006 9:13 AM 数据恢复
good

# Free SharePoint Web Parts (3rd Party) 6/26/2007 8:11 AM The Boiler Room - Mark Kruger, Microsoft SharePoin
Free SharePoint Web Parts (3rd Party) Konrad Brunner - UGS&#39;s Web Parts (broken link 8/25) Document

Post Feedback

Title:
Name:
Url:
Comments: 
Enter the code you see: