This topic describes how to create a password extension using Microsoft Visual Basic and Microsoft Visual Studio 2008.

To create a password extension project, copy the Microsoft.MetadirectoryServices assembly to your development system and manually create a reference to the assembly. You can find the assembly in the bin\assemblies folder of the Forefront Identity Manager Synchronization Service (FIM Synchronization Service) program folder. The default folder is %ProgramFiles%\Microsoft Forefront Identity Management\2010\Synchronization Service\bin\assemblies\.

To create a new Visual Basic class library project using Visual Studio 2008

  1. Click Start, point to All Programs, and then click Microsoft Visual Studio 2008.

    The Visual Studio 2008 development environment appears.

  2. On the File menu, point to New, and then click Project.

  3. In the New Project dialog box, under Project Types, click Visual Basic.

  4. On the Template menu, click Class Library.

  5. In the Name box, type the name of your rules extension, and then click Browse.

  6. Browse to the location where you want to store the project files, click Open, and then click OK. Your project name now appears in Solution Explorer.

To add a reference to the Microsoft.MetadirectoryServices assembly

  1. On the Project menu in Visual Studio 2008, click Add Reference.

  2. On the .NET tab of the Add Reference dialog box, click Microsoft.MetadirectoryServices, and then click OK. If the file does not appear in the Component Name list, click the Browse tab. Browse to the folder that contains the assembly file, click Microsoft.MetadirectoryServices, and then click Open.

  3. Click OK to close the Add Reference dialog box.

    In Solution Explorer, the Microsoft.MetadirectoryServices namespace now appears as one of the references.

To implement the interfaces

  1. Change Class1 to the name of your class.

  2. Following the class declaration, type Implements Microsoft.MetadirectoryServices.IMAPasswordManagement to implement the IMAPasswordManagement interface. When you press ENTER, the following code appears:

    Visual Basic  Copy Code
    Public Sub BeginConnectionToServer(ByVal connectTo As String, ByVal user As String, ByVal password As String) Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.BeginConnectionToServer
    End Sub
    Public Sub ChangePassword(ByVal csentry As Microsoft.MetadirectoryServices.CSEntry, ByVal OldPassword As String, ByVal NewPassword As String) Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.ChangePassword
    End Sub
    Public Sub EndConnectionToServer() Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.EndConnectionToServer
    End Sub
    Public Function GetConnectionSecurityLevel() As Microsoft.MetadirectoryServices.ConnectionSecurityLevel Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.GetConnectionSecurityLevel
    End Function
    Public Sub RequireChangePasswordOnNextLogin(ByVal csentry As Microsoft.MetadirectoryServices.CSEntry, ByVal fRequireChangePasswordOnNextLogin As Boolean) Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.RequireChangePasswordOnNextLogin
    End Sub
    Public Sub SetPassword(ByVal csentry As Microsoft.MetadirectoryServices.CSEntry, ByVal NewPassword As String) Implements Microsoft.MetadirectoryServices.IMAPasswordManagement.SetPassword
    End Sub

To build the class library

  1. On the Build menu, click Build Solution.

    If you receive the following message, the password extension was successfully built:

      Copy Code
    ------ Build started: Project: Password Extension, Configuration: Debug .NET ------
    Preparing resources...
    Updating references...
    Performing main compilation...
    Building satellite assemblies...
    ---------------------- Done ----------------------
    	Build: 1 succeeded, 0 failed, 0 skipped

    The password extension file, which has a .dll extension, is in the bin\Debug folder of your project folder.Before using the password extension, install the file in the extensions folder. The default extensions folder is %ProgramFiles%\Microsoft Forefront Identity Management\2010\Synchronization Service\Extensions.

This following procedure is optional. You can set Visual Studio 2008 to install the password extension automatically in the extensions folder as part of the build process as follows.

To install the password extension in the extensions folder

  1. In Solution Explorer, click your class library project.

  2. On the View menu, click Property Pages.

    There are two folders in the Property Pages dialog box: Common Properties and Configuration Properties.

  3. Open the Configuration Properties folder. In the Configuration drop-down list, click All Configurations.

  4. In the left pane of the Property Pages dialog box, click Build.

  5. In Output Path, type the name of the rules extensions folder, or browse to the location of the rules extensions folder. The default folder for rules extensions is %ProgramFiles%\Microsoft Forefront Identity Management\2010\Synchronization Service\Extensions.

See Also