The following examples show how to provision a Forefront Identity Manager Certificate Management (FIM CM) Duplicate request. The first example demonstrates how to do this using CreateDuplicateRequest. The second example shows a more manual approach.

CLMUtils.CreateDuplicateRequest

Visual Basic  Copy Code
Sub Provision(ByVal mventry As MVEntry)
	Implements IMVSynchronization.Provision

	Try
		If mventry("objectGUID").IsPresent Then
			CLMUtils.CreateDuplicateRequest(CLMMA,
				New Guid(mventry("objectGUID").BinaryValue),
				"CLM Sample Profile Template", 1)
		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
C#  Copy Code
void IMVSynchronization.Provision (MVEntry mventry)
{
	try
	{
		if (mventry["objectGUID"].IsPresent)
		{
			CLMUtils.CreateDuplicateRequest(CLMMA,
				new Guid(mventry["objectGUID"].BinaryValue),
				"CLM Sample Profile Template",
				1);
	}
}
	// Log and rethrow any exception.
	catch(Exception ex)
	{
		Logging.Logging.LogException(ex,
			"Provision",
			"Caught exception",
			false);
		throw;
}
}

Provision Duplicate Request

Visual Basic  Copy Code
Sub Provision(ByVal mventry As MVEntry)
	Implements IMVSynchronization.Provision

	Try
		If mventry("objectGUID").IsPresent 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 = 6
			csentry("req_type_name").Value = "Duplicate"
			csentry("req_target_user_uuid").BinaryValue =
				mventry("objectGUID").BinaryValue
			csentry("req_profile_template_name").Value =
				"Smart Card User Template"
			csentry("req_profile_template_uuid").BinaryValue =
				New Guid().ToByteArray()
			' GUID of profile template you can get from
			'CLMUtils.GetProfileUuidFromProfileTemplateName
			'or manually.
			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
C#  Copy Code
void IMVSynchronization.Provision(MVEntry mventry)
{
	try
	{
		if (mventry["objectGUID"].IsPresent)
		{
			ConnectedMA targetCLMMA =
				mventry.ConnectedMAs["CertificateLifecycleManagerMA"];
			CSEntry csentry =
				targetCLMMA.Connectors.StartNewConnector("clmRequest");

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

			csentry["req_type"].IntegerValue = 6;
			csentry["req_type_name"].Value = "Duplicate";
			csentry["req_target_user_uuid"].BinaryValue =
				mventry["objectGUID"].BinaryValue;
			csentry["req_profile_template_name"].Value =
				"Smart Card User Template";
			csentry["req_profile_template_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