Show All

# Email Sample

The Email research service integrates a directory search into Microsoft® Office 2003 applications. It enables a search based on e-mail name, first name, last name, or full name.

Adapting the Email research service to your network configuration

This research service uses the Active Directory® directory service on a Microsoft Windows® network. Before you run this sample, you will have to modify the connection string sLDAP in email.asmx.cs to adapt the service to your network, which must support the Lightweight Directory Access Protocol (LDAP). Once you have modified the connection string, you can build the research service.

Building the Email research service

The Research Service SDK provides the email.asmx and email.asmx.cs source files for the Email research service. This section describes how to build the Email research service as a Web service based on these files.

Requirements

- Microsoft Office 2003
- Microsoft .NET Framework 1.0 or later
- Microsoft .NET Framework 1.0 Software Development Kit, or a later release
- Microsoft Internet Information Services (IIS) 5.0 or later

Note IIS should be installed before you set up the Microsoft .NET Framework SDK. If you have installed or re-installed IIS after setting up the Microsoft .NET Framework SDK, you will experience unexpected behavior when you try to view ASP.NET pages. To fix this, register ASP.NET with IIS again by running the aspnet_regiis.exe utility. For more information, see Knowledge Base article 306005 , "HOWTO: Repair IIS Mapping After You Remove and Reinstall IIS.”

Build the research service

1. Do one of the following:
   - If you have installed the Research SDK on the computer that hosts the IIS server ServerName, go to step 2.

   - If you have installed the Research SDK on a computer other than ServerName:

     1. Create a folder named Email Sample on ServerName.

        Note To avoid access problems when running the Email Web service, do not place the Email Sample folder in the My Documents folder.

     2. From the computer that the SDK is installed on, copy the contents of the Email Sample folder (under Drive:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Research Service SDK\Samples) to the Email Sample folder on ServerName.

2. Map the Email Sample folder to a virtual directory named EmailService on the IIS server ServerName.

   1. From the Windows Start menu, click Control Panel, and then double-click Administrative Tools.
   2. Double-click Internet Information Services.
   3. In the Internet Information Services folder tree, expand the folders for the local computer, the Web Sites directory, and the Default Web Site.
   4. Create a new virtual directory EmailService by right-clicking Default Web Site and selecting New and Virtual Directory. Follow the instructions on the Virtual Directory Creation Wizard.
3. From the Windows command prompt on the ServerName computer, change to the Email Sample\Email folder and run make.bat to compile and build the Web service. The assembly file Email.dll will be generated in the Email Sample\Bin folder.

   Note Make.bat uses the Microsoft Visual C#® command-line compiler, csc.exe, which is available as part of the Microsoft .NET Framework SDK. If necessary, modify make.bat to include a search path for the compiler.

Configuring the smart tag

The research service uses a client-side smart tag to provide a richer set of features to interact with documents. If the smart tag is not installed, the research service will continue to function normally, with the exception that the smart tag menu items will not be available.

To install the smart tag on a client computer:

1. Do one of the following:
   - If you have installed the Research Service SDK on the client computer, go to step 2 below.

   - If you have installed the Research Service SDK on a computer other than the client computer:

     1. Create a folder named Email Sample on the client computer.
     2. From the computer that the SDK is installed on, copy the contents of the Email Sample folder (under Drive:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Research Service SDK\Samples) to the Email Sample folder on the client computer.
2. On the client computer, open a command prompt and navigate to Email Sample\Email\EmailContactSmartTag.
3. Register the smart tag DLL with the following command-line command:

       regsvr32 CorpContact.dll

4. A message box will appear stating, "DllRegisterServer in corpcontact.dll succeeded." Click OK.
5. To notify Office that this smart tag is available, type the following at the command line:

       regedit CorpContact.reg

   You will be prompted to confirm that you want to add this information into the registry. Click Yes.
6. A message box will appear stating, "Information in corpcontact.reg has been successfully entered into the registry." Click OK.
7. Reboot the client computer.

Using the Email research service

Before you can search on the Email research service for the first time, you must add the research service to the Research task pane by using the URL http://ServerName/EmailService/Email/email.asmx. For more information about adding a research service, see Adding Services through the Office User Interface.

## Search the Email research service

This section assumes the Email research service uses Active Directory within a Windows network.

1. On the Research task pane, under Search for, type the e-mail address, first name, last name, or full name of the person you are searching for in Active Directory. You can enter * as a wildcard character.
2. You can specify that the returned results should be sorted by full name, last name, or first name, and in ascending or descending order.

Design of the Email research service

The Email research service specifies two Web methods: Query and Registration under the Search namespace. The Web page http://ServerName/EmailService/Email/email.asmx provides a brief description and a hyperlink to the formal definition of each of these methods.

Query

This method searches the Active Directory service of a sample domain for a specified e-mail name, first name, last name, or full name. It returns a query response to the Research task pane, which will display the search results in the specified sort criteria. The query response supports the Microsoft.Search.Response Schema.

To adapt this sample to search other networks that support LDAP, modify the connection string for the constant `sLDAP`. You can also modify the fields to be displayed in the search results with the GetSearchResult method.

Registration

This method is called when you first add the Email research service to the task pane. At this point, the service sends a registration request. The Registration method always returns a registration response. The registration response supports the Microsoft.Search.Registration.Response Schema.

For more information about the research service schemas, see XML Schemas Overview.

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp