Creating a Content Source and More for Searching MCMS with SharePoint - Searching with the MCMS SharePoint Connector
(Page 3 of 4 )
The first thing we'll do for this is to create a new search page in our Tropical Green project. This page will not be a new MCMS template, but a regular ASP.NET page. You could make this a template, but there's no real advantage in doing so because there will only be a single search page on our site with no extra content.
- In Visual Studio .NET, right-click on the Tropical Green project and select Add Web Form.
- Name the new ASPX page Search.aspx and click Open.
- If the page doesn't load in Design mode, click Design in the lower left corner.
- Change the page layout to FlowLayout.
- Drag the /Styles/styles.css,
/UserControls/TopMenu.ascx, and /UserControls/RightMenu.ascx files from Solution Explorer onto the designer.
- Switch to HTML mode and modify the body tag as follows:
<body topmargin="0" leftmargin="0" rightmargin="0">
- Add the following code between the <form> and </form> tags, replacing the two user controls that were just added:
<form id="Form1" method="post" runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
&<tr>
<td width="100%" colspan="2" valign="top" bgcolor="#ffcc00">
<img src="/tropicalgreen/images/ Logo.gif">
</td>
<td vAlign="top" rowSpan="10"> </td>
</tr>
<tr bgColor="#66cc33">
<td colSpan="2"><uc1:TopMenu id="TopMenu1"
runat="server"></uc1: TopMenu</td>
</tr>
<tr>
<td vAlign="top" style="PADDING-RIGHT:30px; PADDING-LEFT:30px;
PADDING-BOTTOM:30px;">
<p> </p>
<table cellspacing="0" cellpadding="10" border="1"
bordercolor="#669900">
<tr vAlign="top">
<td>Tropical Green Search:</td>
</tr>
<tr>
<td vAlign="top">
</td>
</tr>
</table>
</td>
<td class="RightMenuBar" width="20%" valign="top" height="100%"
align="center" rowspan="2" bgcolor="#669900">
<uc1:RightMenu id="RightMenu1" runat="server"></uc1:RightMenu>
</td>
</tr>
</table>
</form>
Why did we drag the user controls onto the page and then replace the resulting HTML?
Dragging the user controls onto the page adds the <%@ Register %> lines to the ASPX for us as well as adding the user control ASP.NET tags to the HTML. We then only need to modify the HTML to make it more presentable.
You should now have a page that looks like the following when viewed in Design mode:

Let's save our new search page, build the Tropical Green project, and navigate to it in a browser to make sure everything is in order before we go about adding the search input and results controls.
- Save all changes to the search.aspx page.
- Right-click the TropicalGreen project and select Build.
- If there are no errors in the build, open a browser and navigate to: http://www.tropicalgreen.net/ TropicalGreen/Search.aspx.
- If there are any issues, retrace the steps we've taken to this point, address the errors, and retry the URL.
Now that we have a working search page, we need to add some functionality to it. We'll add the two MCMS Connector server controls, make some configuration changes, build the solution, and test our search page.
- Open the search.aspx page in Visual Studio .NET if it's not already open, and switch to Design view.
- Open the Visual Studio .NET Toolbox and drag the SearchInputControl and SearchResultsControl into the table cell below the Tropical Green Search cell. Refer to the following image for placement:

- Select the SearchInputControl we added to search.aspx and set the following properties in the Visual Studio .NET property window:
Property | Value |
SearchMode | Simple |
SearchResultPage | /TropicalGreen/Search.aspx |
Select the SearchResultControl we added to the search.aspx page and set the following properties using the Visual Studio .NET property window:
| Property | Value |
| PortalUrl | http://portal.tropicalgreen.net/ |
| SearchResultPageSize | 10 |
We're using the URL of the portal created in Appendix A. Replace this URL with whatever portal you configured for the content source and search group in the steps already covered in this chapter.
Let's see if our search is working. Save all changes to search.aspx, build the Tropical Green project, and go to http://www.tropicalgreen.net/TropicalGreen/
Search.aspx in a browser. You should see a page similar to the one below:

Enter a word you know will be found on the site, such as ficus. You will see the same list of search results that were returned when searching for the same string in the portal containing the content index.

If you receive an error message stating "There was a problem loading the input control. The error returned by the system is: Could not find part of the path c:\inetpub\wwwroot\
tropicalgreen\cms\wssintegration\ searchpropertycollection.xml", double-check that you added the CMS virtual directory in your TropicalGreen web application.
At this point, we have got search capabilities on our site thanks to the MCMS Connector controls and SPS's search features. But this solution is very limited, for instance there is no way to change the look and feel of these controls and there is also no way to configure which properties are displayed in the result page, for instance to show a short description for the returned documents.
To address this, we will now build our own search controls.
Next: Building a Custom Search Implementation >>
More Windows Scripting Articles
More By PACKT Publishing
|
This article is excerpted from chapter five of the book Advanced Microsoft Content Management Server Development, written by Lim Mei Ying et al. (PACKT, 2005; ISBN: 1904811531). Check it out today at your favorite bookstore. Buy this book now.
|
|