This example shows how to provision a Microsoft Exchange 2000 or Exchange 2003 distribution list object in Forefront Identity Manager Synchronization Service (FIM Synchronization Service).

Attribute Inclusion List

You must select the following attributes from the Select Attributes property page for your Active Directory Domain Services (AD DS) management agent to provision an Exchange distribution list:

  • mailNickname

  • groupType

Provisioning an Exchange Distribution List

The following examples show how to use a rules extension to provision an Exchange distribution list. You must add a reference to logging.dll to use the LogException method.

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

	Dim adMA As ConnectedMA
	Dim csentry As CSEntry
	Dim nickName As String
	Dim dn as ReferenceValue

	try
		adMA	 = mventry.ConnectedMAs("Fabrikam AD MA")

		nickName = mventry("mailNickname").Value

		' Construct the distinguished name.
		dn = adMA.EscapeDNComponent("CN=" + mventry("cn").Value).Concat("ou=mailboxes,dc=fabrikam,dc=com")

		If 0 = adMA.Connectors.Count then
			csentry = ExchangeUtils.CreateDistributionlist(adMA, dn, nickName)
		End If

		' Log and rethrow any exception.
		Catch ex As Exception
			Logging.Logging.LogException(ex, "Provision", "Caught exception", False)
			Throw
	End Try
End Sub
C#  Copy Code
void IMVSynchronization.Provision (MVEntry mventry)
{
	ConnectedMA adMA;
	CSEntry csentry;
	String nickName;
	ReferenceValue dn;

	try
	{
		adMA = mventry.ConnectedMAs["Fabrikam AD MA"];

		nickName   = mventry["mailNickname"].Value;

		// Construct the distinguished name.
		dn = adMA.EscapeDNComponent("CN=" + mventry["cn"].Value).Concat("ou=mailboxes,dc=fabrikam,dc=com");

		if(0 == adMA.Connectors.Count)
		{
			csentry = ExchangeUtils.CreateDistributionlist(adMA, dn, nickName);
	}
}

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

See Also

Reference

CreateDistributionlist

Concepts

Microsoft Exchange Connected Data Sources