Partager via


How to: Create Connected Data Source Extensions in Visual Basic

Note

With the release of ECMA 2.0, this feature has been deprecated and will be removed in future versions. You should use the Extensible Connectivity 2.0 Management Agent Reference for Connector development going forward.

This topic describes how to create a connected data source extension for the extensible management agent using Microsoft Visual Basic and Visual Studio 2008. To create a password extension project, you must 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 for FIM Synchronization Service is %ProgramFiles%\Microsoft Forefront Identity Management\2010\Synchronization Service\bin\assemblies\.

To create a connected data source extension, follow these steps:

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

  2. To add a reference to the Microsoft.MetadirectoryServices assembly

  3. To implement the interfaces

  4. To build the class library

  5. To install the connected data source extension in the extensions folder (optional)

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

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

    The Visual Studio development environment appears.

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

  3. In the New Project dialog box, in 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.

Note

We recommend that you store the project on your local computer instead of in a network location.

To add a reference to the Microsoft.MetadirectoryServices assembly

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

  2. In 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,Microsoft.MetadirectoryServices now appears as one of the references.

You must implement an import and export interface in your extension. You can implement the IMAExtensibleFileImport interface as your import interface. For the export interface, implement either the IMAExtensibleCallExport interface for a call-based data source or the IMAExtensibleFileExport interface for a file-based data source.

To implement the interfaces

  1. Change Class1 to the name of your class.

  2. To implement the IMAExtensibleFileImport interface, type Implements Microsoft.MetadirectoryServices.IMAExtensibleFileImport. When you press ENTER, the following code appears:

    Public Sub GenerateImportFile(ByVal fileName As String, ByVal connectTo As String, ByVal user As String, ByVal password As String, ByVal configParameters As Microsoft.MetadirectoryServices.ConfigParameterCollection, ByVal fFullImport As Boolean, ByVal types As Microsoft.MetadirectoryServices.TypeDescriptionCollection, ByRef customData As String) Implements Microsoft.MetadirectoryServices.IMAExtensibleFileImport.GenerateImportFile
    
    End Sub
    
  3. In the line following the first Implements statement, do one of the following:

    • To implement the IMAExtensibleCallExport interface to export data to a call-based data source, type Implements Microsoft.MetadirectoryServices.IMAExtensibleCallExport.

    • To implement the IMAExtensibleFileExport interface, type Implements Microsoft.MetadirectoryServices.IMAExtensibleFileExport.

    If you are implementing the IMAExtensibleCallExport interface, the following code appears:

    Public Sub BeginExport(ByVal connectTo As String, ByVal user As String, ByVal password As String, ByVal configParameters As Microsoft.MetadirectoryServices.ConfigParameterCollection) Implements Microsoft.MetadirectoryServices.IMAExtensibleCallExport.BeginExport
    
    End Sub
    
    Public Sub EndExport() Implements Microsoft.MetadirectoryServices.IMAExtensibleCallExport.EndExport
    
    End Sub
    
    Public Sub ExportEntry(ByVal modificationType As Microsoft.MetadirectoryServices.ModificationType, ByVal changedAttributes() As String, ByVal csentry As Microsoft.MetadirectoryServices.CSEntry) Implements Microsoft.MetadirectoryServices.IMAExtensibleCallExport.ExportEntry
    
    End Sub
    

    If you are implementing the IMAExtensibleCallExport interface to export data to a call-based data source, change the code as appropriate.

To build the class library

  1. In Visual Studio, on the Build menu, click Build Solution.

    If you see the following message, the extension was successfully built:

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

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

The following procedure is optional. You can set Visual Studio 2008 to install the connected data source extension automatically in the extensions folder as part of the build process.

To install the connected data source 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

Concepts

Creating Connected Data Source Extensions
Connected Data Source Extensions for Call-Based Data Sources
Connected Data Source Extensions for File-Based Data Sources