Click to return to the Server Technologies home page    
Web Workshop  |  Server Technologies

Extending Web-Based Knowledge Management with Microsoft Exchange Server


Thomas Rizzo
Microsoft Corporation

July 17, 1998

Download Download the sample application and documentation (zipped, 1.49 MB).

Contents
Introduction
The Sample Application
How It Works and How You Can Set It Up
Security Requirements
The ASP Search Page
Conclusion

Introduction

The amount of information generated today is exploding, especially within businesses. With the growth of the Internet and the ubiquitous connectivity it provides for businesses, information overload can quickly become a problem for many corporate users. Users can sign up for a variety of information sources such as Internet newsgroups, list servers, or Web page updates. Your corporation may even have internal discussion aliases. Although the availability of information and knowledge sharing helps users make better decisions, it also forces users to spend more time sifting through information to find the relevant bits and pieces they need for their job. What corporations need is a way to index and search across all of these different data sources, making it easier and less time-consuming for users to find relevant information.

Say hello to Microsoft® Site Server 3.0 and Microsoft Exchange Server 5.5. While Site Server provides the necessary features for full-text indexing, and search and knowledge delivery; Exchange Server provides the collaborative infrastructure and functionality that makes creating Internet newsgroups, threaded discussions, customer contact databases, and custom collaborative applications easy. Combine these two products and you have a knowledge management solution that can make your search page the most popular page on your intranet.

This article explains how you can extend the Knowledge Management features of Site Server 3.0 with Microsoft Exchange Server and Microsoft Outlook™ to build high-powered Web-based Knowledge Management solutions. You will learn how to use the built-in full-text indexing of Exchange Public Folders in Site Server, and how to extend the search capabilities of Site Server with custom ASP code that enables you to build customized search pages. These search pages allow your users to find information stored throughout the Exchange system whether the information is a NNTP news item, a posted item in a Public Folder or an email discussion archived in a Public Folder.

This article assumes that you have a working knowledge of Site Server Search. For information on Site Server Search, see Creating a Search Catalog for Your Site. For more how-to information on Site Server, see the SBN/MSDN feature articles.

The Sample Application

To start off, I'll show you just one of the possibilities: here's a sample search site (downloadable from the top of this article) that shows you how you can customize the search capabilities provided by Microsoft Site Server when indexing Exchange Public Folders. Figure 1 shows the default page of the application. You can search on who posted the item or when it was posted, and also by custom properties such as the issue type of an item (which can be problem, resolution, or best practice).

Figure 1. Default page of sample application

When a user clicks the Search button, the page queries the corresponding catalog of information and returns the results to the browser as shown in Figure 2.

Figure 2. Results returned

Note the HTML page icon next to the hyperlink for the item. The hyperlink on the item will launch Microsoft Outlook on the user's machine so the user can read the item. If the user does not have Microsoft Outlook, Microsoft Outlook Web Access will be launched to display the item. Figure 3 shows Outlook 98 reading the item and Figure 4 shows Outlook Web Access reading the same item.

Figure 3. Microsoft Outlook 98 displaying the item

Figure 4. Microsoft Outlook Web Access displaying the item

Please note that the custom Outlook Form was converted to an HTML form by using the new Microsoft Outlook HTML Form Converter. For more information on the form converter, please visit http://www.microsoft.com/backoffice/ Non-MSDN Online link.

The sample application uses a custom Outlook form in an Exchange Public Folder to prompt the user for the item's issue type as they post it. However, there are other ways you can use Public Folders to store information without creating custom Outlook forms. One way is to make Public Folders part of discussion distribution lists. With this method, the Public Folder serves as an archive of the information that is sent to the distribution list. Having this archive lets users search this information and avoid posting a question to the distribution list that may already be answered.

Another way to use Public Folders to gather and distribute information is to set one up as an incoming and outgoing Internet news server. Public Folders support replicating Internet newsgroup information into the folder. You can store this information in a central location rather than having individual users connecting to Internet newsgroups from their own machines. The other benefit is that users can then use Outlook to change the views of the content as well as add new content. This new content can be replicated to the Internet by Exchange Server.

How It Works and How You Can Set It Up

Before you can even start using Site Server with Exchange, you need to create a Public Folder that will contain the items you want your users to share. You can create custom Outlook forms, Web applications, or just use the built-in capabilities of Outlook to add information into this Public Folder. To help you get started with custom forms, there is a custom Outlook form and the Outlook form converted to a Web form in the sample application. To learn how to set up these forms in Outlook and Outlook Web Access, please read the setup guide included with the downloadable sample. The sample application contains three custom fields on the Outlook and Web form: Type, Industry, and Product. When we create the search catalog, Site Server will automatically index these custom properties so that users can search on these properties. You do not have to add custom Exchange and Outlook properties to the Site Server schema to search on the properties. As you will see in the sample code, all you need to do is use the @META_customname syntax in your search page to search on Exchange custom properties.

Now we can set up Site Server to leverage the knowledge you store in Exchange. The first step is to create a search catalog, which is the index and property store that Site Server creates and your users can search. In the same catalog, you can create an index of Exchange Public Folders, and also open database connectivity (ODBC) databases, Web pages, Microsoft Office documents, and items from the file system. When indexing Public Folders, Site Server also indexes any documents in the Public Folder (such as Office documents) and enables you to search for text or properties contained in those Office documents.

To set up Site Server to create this index, you must first run the Create New Catalog Definition Wizard in the Microsoft Management Console (MMC) administrator for Site Server.

  1. In the MMC, right-click your Catalog Build Server as shown in Figure 5 and select New Catalog Definition with Wizard.

    Figure 5. Running the Create New Catalog Definition Wizard

  2. In the wizard, type in a catalog name and then select the Exchange crawl option. The wizard will present a start address that looks like:
    exch://yourservername/Public Folders/All Public Folders/.
  3. After the last /, type the path to the Public Folder you want to have Site Server index. For example, if you had a Public Folder in your Public Folder hierarchy named Helpdesk under the IT Applications folder, the Site Server start address would be exch://yourservername/Public Folders/All Public Folders/IT Applications/Helpdesk. You can also enable Site Server to crawl all the subfolders under your start address automatically. This is very useful if you use many child folders in your organization. The best example of this is if you use Exchange for NNTP newsgroups.
  4. The next step is to tell Site Server where to propagate the final catalog to after it completes indexing the items.
  5. Finally, click the Build Now check box and select Finish in the wizard. That's it. You are now indexing all the items in the folder. You can rerun this wizard to add either other Public Folders to the catalog or other types of data sources.
You can schedule Site Server to update the index you create by doing either a full or incremental build of the contents. Because we will be adding new contents to the Public Folder after creating the Search Catalog, I recommend that you manually force Site Server to rebuild the catalog during the development process. This guarantees that you will have the most recent information from the folder in the catalog.
  1. You can find the manual rebuild command by right-clicking the name of your catalog under the Catalog Build Server section of the MMC window.
  2. Select properties, and go to the Status tab.
  3. Click the right-pointing arrow next to the State label and select Start Incremental Build.

Security Requirements

When setting up your virtual directory to allow searches against Exchange information, you must authenticate the user before Site Server will return information to the browser. This authentication is necessary so that information a particular user should not see is not returned by the search. Because of this authentication requirement, you should disable anonymous access to the virtual directory where you place your search pages and require Basic or Windows NT Challenge/Response authentication, or you should add code to your search page to authenticate the user directly in Visual Basic® Scripting Edition (VBScript) or JavaScript code.

The ASP Search Page

The crux of the application -- beyond the custom forms and the Site Server full-text catalog -- is the custom ASP search page on which users can search for items that meet specific criteria. What you will see in the search page is searching across one Public Folder; however, Site Server supports crawling multiple Public Folders as well as other data sources such as ODBC databases, file folders, Microsoft Office documents, and HTML pages -- all in a single catalog.

Let's take a look at each section of code in search.asp, to see how to create a custom search page using custom Exchange properties with Site Server catalogs.

The first section of search.asp processes the input from the user. Because the application divides the search results into 10 hits at a time, it uses Session variables in ASP to remember the criteria the user entered for their search across the multiple pages. If you customize this application to search on additional properties, be sure to modify this section so that when the user clicks to see more search results, their search criteria is not lost at the top of the HTML page.

<% ' Process Input Section. %>
<% if Request.QueryString <> "" then %>
  <% ' Initialize or set non-predefined variables from information posted to page.
     ' Purpose of DisplayText variable is to have just the words from the query for
     '  display in the introductory sentence and in the more results link.
      if Request("DisplayText")= "" then
        DisplayText= Request("q1")
      else
        DisplayText = Request("DisplayText")
      end if

     ' Purpose of RecordNum variable is to display which records
     ' are displayed on each results page.
      if Request("RecordNum") = "" then
        RecordNum=1
      else
        RecordNum=Request("RecordNum")
      end if

     ' Purpose of session variables is to store information for use in
     ' editing a search. Only information from the initial query is stored:
     ' these variables are not updated on "more results" pages.
     ' If you add additional search criteria in your search page, make sure
     ' to add their initial value to the Session object.
     ' Server.HTMLEncode is required to store queries with double quotes.
      if Request("sh") = "" then
        Session("q1")=Server.HTMLEncode(Request("q1"))
        Session("q2")=Request("q2")
        Session("ct")=Request("ct")
   Session("c3")=Request("c3")
   Session("o3")=Request("o3")
   Session("q3")=Request("q3")
   Session("o4")=Request("o4")
   Session("q4")=Request("q4")
   Session("c5")=Request("c5")
   Session("q5")=Request("q5")
   Session("c6")=Request("c6")
   Session("q6")=Request("q6")
   Session("c7")=Request("c7")
   Session("q7")=Request("q7")
   Session("c8")=Request("c8")
   Session("q8")=Request("q8")
   Session("c9")=Request("c9")
   Session("q9")=Request("q9")
      end if
      ' Read session object into variables.
        q1=Session("q1")
        q2=Session("q2")
        ct=Session("ct")
   c3=Session("c3")
   o3=Session("o3")
   q3=Session("q3")
   o4=Session("o4")
   q4=Session("q4")
   c5=Session("c5")
   q5=Session("q5")
   c6=Session("c6")
   q6=Session("q6")
   c7=Session("c7")
   q7=Session("q7")
   c8=Session("c8")
   q8=Session("q8")
   c9=Session("c9")
   q9=Session("q9")

%>
<% end if %>

The second section of search.asp is the search initiation section. This section displays the form for the user to specify the search criteria. As you can see, the input fields on the form are assigned specific names. To make it easy for you to build custom search pages, Site Server provides what is called Conventional Query String Variables. These variables are two-letter tags that are designed to identify the property you want to query on and the value to use for the criteria for the query. For example, the ct tag identifies the catalog to use for the search. The qn tag (where n is a number) specifies the query string variables. You should use the qn tag in conjunction with the cn tag, because the cn tag specifies the column you want to search for the qn value. As you can see in the code, the qn and cn tags are used heavily. An example query string from a typical search looks like:

q1=&c2=@DocAuthor&q2=&c3=@filewrite&o3=%3E%3D&q3=-
1y&c5=@MessageEmailAddress&q5=&o4=@DocTitle&q4=&c6=@MessageFolder&q6=&ct=Discussion
&c7=@META_Type&q7=&c8=@META_Industry&q8=&c9=@META_Product&q9=

And here's the code.

The next section of the code checks to see if the user has the ActiveX® control installed on his or her machine that launches Outlook so they can view the item. If the user does not, Outlook Web Access will be used to display the item. The code then creates the query to the catalog by using the Site Server Query object. The Query object has a number of properties that you can use to create very complex queries against Site Server catalogs. In the search.asp code, the first step is to create the Query object by calling Server.CreateObject with the ProgID of the Query object, MSSearch.Query. Because the app passes all the information about the query along the URL query string, we can use the method SetQueryFromUrl to have the Query object automatically parse the URL query string and set the Query object properties according to the specified conventional query string variables.

When working with Exchange Server, use the OptimizeFor property to specify that you do not want a hit count. This will improve the performance of your application. The code also uses the MaxRecords property to specify the maximum number of records to return on each page. The Columns property specifies the columns to return in the recordset that we create later on. You have to put the names of the columns you want to display in this property.

The final step in creating the search results is to actually create the recordset of items that match our criteria. To do this, we need to call the CreateRecordSet method on the Query object. This method will create an ActiveX Data Objects (ADO) sequential, forward-only recordset that we can use to display our results. Here's the code.

The final section of the code displays the actual returned items in the recordset using an HTML table. To return the location of the item as a URL, the code uses the DocAddress property contained for each item in the Site Server catalog. The code also displays two ways for the user to view items: using the Outlook client or using Outlook Web Access. Here's the code.

Further instructions and tips are provided in the sample application files.

Conclusion

As you have seen in this article, it is very easy to get started using Exchange Server and Site Server together to manage the daily flood of information that you likely receive into your business. However, this article and sample only scratch the surface of the types of applications you can build when you combine Site Server and Exchange Server. If you are interested in learning more about either of these products and how they can help you build interactive, dynamic and powerful Web sites, please visit http://www.microsoft.com/siteserver/ Non-MSDN Online link and http://www.microsoft.com/exchange/ Non-MSDN Online link.



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.