A A A Font Size

helloitsliam

MOSS2007 – Using the Search API (Part 2)

In my last post we looked at some basic Search API code using our forms application. As a response to this Daniel from "Zevenseas" he has a tool, if you haven't already got it, go get it from here: http://mosssearchcoder.codeplex.com

This application will allow you to create all the Search Queries and even generates the C# code that you may need. Recommend you go get it!!

In this post I wanted to look at changing the code we wrote last time and turn it into a web part. So let's begin. Create a new Web Part project and call it the following:

The code will be the same for our search etc and also our "PublishingRollupImage" CAML Query. The only change is that instead of passing the URL to perform the search query, we use the following:

The code from this point down is more of less the same.

In the previous post we had a checkbox that enabled the "PublishingRollupImage" check. In the web part I wanted to change this to check if this field had been added to the list of fields and then only run of it was.

The user interface for this is simply a set of labels and boxes that are rendered using the following syntax for each item.

Now we have our web part built it should render as the following (Ignore the layout etc, just showing functionality):

When we run this without the "PublishingRollupImage" field it shows as below:

When we run this with the "PublishingRollupImage" field it shows as below:

As you can see this is now functioning as in the previous post. In the next post we will look at changing this and using the Search Core Results Web Part and using our custom CAML code we created previously. J

 

 

You must sign in to rate content.
(Unrated)

Comments

There are no comments yet for this post.

Leave a Comment

You must be logged in to post a comment.
Superstar
Liam Cleary
Senior Solution Architect | SharePoint MVP
SUSQTECH
Sheffield, UK
Liam is working as usual, SharePoint, SharePoint and then some more SharePoint!!

Search This Blog

 

© 2010 SusQtech. All rights reserved.
Powered by SharePoint Server 2007 and using the MemberToMember SharePoint Add-On for social media capabilities.