How to: Provision Connected Data Sources That Expect FIM Synchronization Service to Provide the Anchor Attributes

Certain connected data sources expect that when objects are exported, they will have anchor attributes. When you export objects into data sources that expect anchor attributes, use Synchronization Service Manager to configure attributes as anchor attributes. For more information about configuring anchor attributes, see Forefront Identity Manager Technical Reference.

The following examples show how to provision objects for connected data sources that expect anchor attributes.

Public Sub Provision( _
    ByVal mventry As MVEntry) _
    Implements IMVSynchronization.Provision

   Dim ManagementAgent As ConnectedMA  ' Management agent object
   Dim Connectors As Integer           ' Number of connectors under this 
                                       ' management agent
   Dim Anchor As String                ' Anchor attribute string
   Dim csentry As CSEntry              ' Connector space entry object

    ' Determine the state of the <tla rid="fim_syncdb_short" /> object.
    If mventry("employeeID").IsPresent _
        AndAlso mventry("employeeStatus").IsPresent _
        AndAlso mventry("employeeStatus").Value.Equals("active") Then

        ' Get the management agent.
        ManagementAgent = mventry.ConnectedMAs("Primary Key Data Source MA")

        ' Get the number of connectors for this MVEntry object under
        ' this management agent.
        Connectors = ManagementAgent.Connectors.Count

        ' Construct an anchor based on a <tla rid="fim_syncdb_short" /> object attribute.
        Anchor = mventry("employeeID").Value

        If 0 = Connectors Then

            ' Create a new connector.
            csentry = ManagementAgent.Connectors.StartNewConnector("person")

            ' Set the anchor attribute configured on this management agent.
            csentry("employeeID").Value = Anchor

            ' Add the connector to the connector collection.
            csentry.CommitNewConnector()

        ElseIf 1 = Connectors Then

            ' If the connector already exists and you want to use
            ' this connector, remove the comment from the following line and 
            ' add your code.
            ' csentry = ManagementAgent.Connectors.ByIndex(0)

        Else
            Throw New UnexpectedDataException("Multiple connectors on the management agent.")
        End If

    End If
End Sub
void IMVSynchronization.Provision (MVEntry mventry)
{
    ConnectedMA ManagementAgent;    // Management agent object
    int Connectors;                 // Number of connectors under this 
                                    // management agent
    string Anchor;                  // Anchor attribute string
    CSEntry csentry;                // Connector space entry object

    // Determine the state of the <tla rid="fim_syncdb_short" /> object.
    if (mventry["employeeID"].IsPresent && 
        mventry["employeeStatus"].IsPresent && 
        mventry["employeeStatus"].Value.Equals("active"))
    {
        // Get the management agent.
        ManagementAgent = mventry.ConnectedMAs["Primary Key Data Source MA"];

        // Get the number of connectors for this MVEntry object under
        // this management agent.
        Connectors = ManagementAgent.Connectors.Count;

        // Construct an anchor based on a <tla rid="fim_syncdb_short" /> object attribute.
        Anchor = mventry["employeeID"].Value;

        if(0 == Connectors)
        {

            // Create a new connector.
            csentry = ManagementAgent.Connectors.StartNewConnector("person");

            // Set the anchor attribute configured on this management agent.
            csentry["employeeID"].Value = Anchor;

            // Add the connector to the connector collection.
            csentry.CommitNewConnector();
        }

        if (1 == Connectors)
        {

            // If the connector already exists and you want to use
            // this connector, remove the comment from the following line and 
            // add your code.
            // csentry = ManagementAgent.Connectors.ByIndex(0)
        } 

        else
        {
            throw new UnexpectedDataException("Multiple connectors on the management agent.");
        }
    }

}

See Also

Reference

StartNewConnector
CSEntry
CommitNewConnector

Concepts

Provisioning Objects in the Connector Space