Partager via


How to: Provision a FIM Certificate Management Online Update Request

The following examples show how to provision a Forefront Identity Manager Certificate Management (FIM CM) Recover request. The first example demonstrates how to do this using CreateOnlineUpdateContentChangeRequest. The second shows a more manual approach. You can use Utils.TransactionProperties to trigger an online update request and to help to ensure that only one request is created. Otherwise, each time CLMUtils.CreateOnlineUpdateRequest is called, a new request is created.

CLMUtils.CreateOnlineUpdateRequest

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

    Try
        If mventry("objectGUID").IsPresent And
            Utils.TransactionProperties(
            "triggerUpdate").Equals(True) Then
            CLMUtils.CreateOnlineUpdateRequest(CLMMA,
                New Guid(mventry("objectGUID").BinaryValue),
                "CLM Sample Profile Template")
        End If
    ' Log and rethrow any exception.
    Catch ex As Exception
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            False)
        Throw
    End Try

End Sub 'IMVSynchronization.Provision
void IMVSynchronization.Provision (MVEntry mventry)
{
    try
    {
        if (mventry["objectGUID"].IsPresent &&
            Utils.TransactionProperties["triggerUpdate"].Equals(true))
        {
            CLMUtils.CreateOnlineUpdateRequest(CLMMA,
                new Guid(mventry["objectGUID"].BinaryValue),
                "CLM Sample Profile Template");
        }
    }
    // Log and rethrow any exception.
    catch(Exception ex)
    {
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            false);
        throw;
    }
}

Provision Online Update Request

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

    Try
        If mventry("objectGUID").IsPresent And
            Utils.TransactionProperties(
            "triggerRecover").Equals(True) Then
            Dim targetCLMMA As ConnectedMA =
                mventry.ConnectedMAs("CertificateLifecycleManagerMA")
            
            Dim csentry As CSEntry =
                targetCLMMA.Connectors.StartNewConnector("clmRequest")
            
            csentry.DN = targetCLMMA.EscapeDNComponent("CN=" +
                Guid.NewGuid().ToString())
            
            csentry("req_type").IntegerValue = 10
            csentry("req_type_name").Value = "OnlineUpdate"
            csentry("req_profile_uuid").BinaryValue =
                New Guid().ToByteArray()
            ' GUID of profile to associate request with
            csentry.CommitNewConnector().
        End If
    
    ' Log and rethrow any exception.
    Catch ex As Exception
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            False)
        Throw
    End Try

End Sub 'IMVSynchronization.Provision
void IMVSynchronization.Provision(MVEntry mventry)
{
    try
    {
        if (mventry["objectGUID"].IsPresent &&
            Utils.TransactionProperties["triggerRecover"].Equals(true))
        {
            ConnectedMA targetCLMMA =
                mventry.ConnectedMAs["CertificateLifecycleManagerMA"];

            CSEntry csentry =
                targetCLMMA.Connectors.StartNewConnector("clmRequest");

            csentry.DN = targetCLMMA.EscapeDNComponent("CN=" +
                Guid.NewGuid().ToString());

            csentry["req_type"].IntegerValue = 10;
            csentry["req_type_name"].Value = "OnlineUpdate";
            csentry["req_profile_uuid"].BinaryValue =
                new Guid (GUIDValue).ToByteArray();
                // GUIDValue should be the GUID of the 
                // profile template
                // you can get from
                // CLMUtils.GetProfileUuidFromProfileTemplateName or
                // manually.
            csentry.CommitNewConnector();
        }
    }

    // Log and rethrow any exception.
    catch (Exception ex)
    {
        Logging.Logging.LogException(ex,
            "Provision",
            "Caught exception",
            false);
        throw;
    }
}

See Also

Reference

CreateOnlineUpdateContentChangeRequest

Concepts

Forefront Identity Manager Certificate Management Connected Data Sources