Microsoft Identity Integration Server 2003 Developer Reference

Microsoft Exchange Connected Data Sources

Provisioning objects for Microsoft Exchange includes creating mailboxes, distribution list, and mail-enabled entities such as contacts and users. Since provisioning contains a number of basic steps, see the Provisioning Objects in the Connector Space topic for an overview on provisioning.

Provisioning Exchange Objects Examples

This section provides the following examples that 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 on the Active Directory or Exchange management agent. These attributes are listed at the beginning of each example.

Framework

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

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

[Visual Basic .NET]
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#]
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)
	{
		//...
}
}