Provisioning objects for Microsoft Exchange includes creating mailboxes, distribution lists, and mail-enabled entities such as contacts and users. Because provisioning from Forefront Identity Manager Synchronization Service (FIM Synchronization Service) includes a number of basic steps, see Provisioning Objects in the Connector Space for an overview of provisioning.

Provisioning Exchange Objects Examples

This section provides the following examples, which show how to provision various Microsoft Exchange objects:

Attribute Inclusion List

For the provisioning examples to work, you must select a number of attributes from the Select Attributes property page in Active Directory Domain Services (AD DS) or Exchange Management Agent. These attributes are listed at the beginning of each example.

Framework

Because many of the steps for provisioning an Exchange object are the same, the following examples show the framework, in Microsoft Visual Basic and Visual C#, around which the example tasks are built.

The following example shows how to use a rules extension to provision an Exchange object. Note the comment "Set any other required attributes." This is where you set the attributes that are required by the example tasks.

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

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

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

		nickName   = mventry("mailNickname").Value
		mailboxMDB = mventry("homeMDB").Value

		' Set any other required attributes.
		' ...

		' 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.CreateMailbox(adMA, dn, nickName, mailboxMDB, ...)
		End If

		' Handle any exceptions.
		Catch ex As Exception
			'...
	End Try
End Sub
C#  Copy Code
void IMVSynchronization.Provision (MVEntry mventry)
{
	ConnectedMA adMA;
	CSEntry csentry;
	String nickName, mailboxMDB;
	ReferenceValue dn;

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

		nickName   = mventry["mailNickname"].Value;
		mailboxMDB = mventry["homeMDB"].Value;

		// Set any other required attributes.
		// ...

		// 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.CreateMailbox(adMA, dn, nickName, mailboxMDB, ...);
	}
}

	// Handle any exceptions.
	catch(Exception ex)
	{
		//...
}
}

See Also