Microsoft® Forefront Identity Manager 2010 (FIM) lets you create custom activities and workflows. These activities can be included in a workflow created by using Windows Workflow Foundation (WF), or in a FIM custom workflow. Creating custom authentication activities requires a different procedure and will be covered in another topic.

Note:
To create a FIM custom activity, you must have .NET Framework version 3.5 installed.

This topic explains how to set up a workflow library to contain FIM custom activities. Other topics that show how to build custom activities will assume that a library similar to this has been created.

To create an FIM Custom Activity Library

  1. Start Visual Studio 2008.

  2. Create a new Workflow Activity Library. This example uses Visual C#, but Visual Basic can also be used.

    • On the File menu, click New and then click Project.

    • Under the Visual C# project types, select Workflow. In the Templates pane, select Workflow Activity Library.

    • Give the library a name and then click OK. For this example we named the project FIM.CustomWorkflowsActivityLibrary.

  3. Add references to the FIM assemblies:

    • If the Solution Explorer is not open, on the View menu, click Solution Explorer.

    • In Solution Explorer, right-click the References folder, and then click Add Reference.

    • In the Add Reference dialog box, click the Browse tab, and browse to folder that contains the Microsoft.ResourceManagement.dll assembly.

      Tip:
      The default installation location for this assembly is C:\Program Files\Microsoft Forefront Identity Manager\2010\Service.
    • Select the Microsoft.ResourceManagement.dll assembly, and then click OK.

  4. Give the assembly a strong name so that it can be placed in the Global Assembly Cache (GAC).

    Note:
    Custom activities must be signed in order to for them to load correctly and be displayed in the Workflow Designer in the FIM Portal. See How to: Sign an Assembly with a Strong Name.
    • In Solution Explorer, right-click the Properties folder and then click Open.

      This will open a tab in the workspace that has the same name as your project.

    • Select the Signing tab and select the Sign the assembly check box. Select a strong name key file from the drop-down list or select <New> and create a new key file name. In this example, we named the key file FIM.CustomActivitiesLibrary.

    • Clear the Protect my key file with a password check box.

  5. Set application properties.

    1. Select the Application tab of the dialog that was opened in the previous step.

    2. In Assembly name type "FIM.CustomActivityLibrary". You can use any assembly name that does not already exist in the Global Assembly Cache (GAC) of the machine that is hosting the FIM Service.

    3. In Default namespace type "FIM.CustomActivityLibrary.Activities".

    4. In Target Framework, select .Net Framework 3.5.

    5. Close the file.

  6. Add the FIM activities to the Toolbox. Skip this step if there is already a tab that contains all FIM activities from the ResourceManagement.dll assembly.

    • If the Activity1.cs [Design] tab is not already open, right-click on the "Activity1.cs" file in the Solution Explorer and select View Designer.

    • Select the Activity1.cs [Design] tab.

    • If the Toolbox is not open, click the View menu and select Toolbox.

    • Right-click the Toolbox and select Add Tab. Rename the new tab FIM Activities.

    • Right-click the new tab and select Choose Items….

    • In the Choose Toolbar Items dialog box, click the Activities tab.

    • Click the Clear button to remove other activities from the tab.

    • Click Browse… and browse to the Microsoft.ResourceManagement.dll assembly installed with FIM.

    • Check each checkbox next to activities in the Microsoft.ResourceManagement.Workflows.Activities namespace that you want to include in the toolbox. See Microsoft.ResourceManagement.Workflow.Activities for information about which activities are supported.

    • Click OK.

  7. Your workspace should now resemble the following illustration.

    FIM.CustomActivityLibrary Visual Studio workspace.
  8. Build the project by selecting Solution from the Build menu.

  9. Save the project by selecting Save All from the File menu.

  10. It can be helpful to create separate folders for the project to separate activity code from UI code for the activity.

    1. Right-click the project folder in the Solution Explorer. In our example the folder is named "FIM.CustomWorkflowsActivityLibrary."

    2. Click Add and then click New Folder.

    3. Name the new folder "Activities".

    4. Right-click the project folder in the Solution Explorer.

    5. Click Add and then click New Folder.

    6. Name the new folder "WebUIs".

  11. Delete the "Activity1.cs" activity by right-clicking the activity in the Solution Explorer and then clicking Delete.

Remarks

You can now create custom activities in this library or add custom activities created in other Visual Studio projects to this library. For each activity you create in the project or add to the project, create a folder in the "Activities" folder that has the same name as your activity. Add activity code files to that folder and set the namespace of that activity to be "FIM.CustomActivityLibrary.Activities".

If your activity has a UI, you should create an additional folder in the "WebUIs" folder that has the same name as your activity. Add the class that defines the UI for your activity (the class that implements Microsoft.IdentityManagement.WebUI.Controls.ActivitySettingsPart) to that folder. Set the namespace of that activity to be "FIM.CustomActivityLibrary.WebUI".

See Also