Join Now!
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
Posted on 5/6/2009 at 10:00 AM Permalink | Share This Post | Comments (0) | Leave a Comment
Blog Tags:
Community Tags:
All Blogs
Administration Coding CQWP Download Email How To iPhone Metadata Services MOSS 2007 MOSS Search My Sites Records Management REST Services Search SEO Service Packs SharePoint SharePoint 2010 Toolkit Updates User Experience WCF Web XML