Step 8: Create the MVExtension DLL
By enabling provisioning we will allow our objects in our SQL_ECMA2 to be provisioned into the connector space of our AD_ECMA2 and vice-versa. Creating the Metaverse Rules Extension consists of the following:
-
Create the metaverse rules extension DLL
-
Enable Provisioning
Create the metaverse rules extension DLL
Now we will create our metaverse rules extension DLL. This will be done using the code provided. A full copy of the code is provided in Appendix D: MVExtension Source Code
To create the new management agent DLL
-
In the Synchronization Service, at the top, select Tools and then click Options. This will bring up the Options screen.
-
In options, place a check in Enable metaverse rules extension. This will allow the Create Rules Extension Project button to become enabled.
-
Click Create Rules Extension Project. This will bring up the Create Extension Project dialog.
-
In the Create Extension Project dialog box, next to Programming Language: select Visual C#
-
In the Create Extension Project dialog box, next to Visual Studio Version: select Visual Studio 2010.
-
-
Click OK. This will launch Visual Studio 2010.
-
On the right, at the top, under the Solutions Explorer, double-click MVExtension.cs. This will open the file with code that has already been written.
-
Scoll down to void IMVSynchronization.Provision (MVEntry mventry)
-
. Remove the comments and add the code below
ConnectedMA ManagementAgent; int Connectors = 0; CSEntry csentry; ReferenceValue DN; ManagementAgent = mventry.ConnectedMAs["SQL_ECMA2"]; Connectors = ManagementAgent.Connectors.Count; //Provision to SQL if (0 == Connectors) { csentry = ManagementAgent.Connectors.StartNewConnector("Person"); csentry["EmployeeID"].Value = mventry["employeeID"].Value; csentry["AccountName"].Value = mventry["accountName"].Value; csentry["EMail"].Value = mventry["mail"].Value; csentry["FirstName"].Value = mventry["givenName"].Value; csentry["LastName"].Value = mventry["sn"].Value; csentry["FullName"].Value = mventry["displayName"].Value; csentry.CommitNewConnector(); } if (1 == Connectors) { } ManagementAgent = mventry.ConnectedMAs["AD_ECMA2"]; Connectors = ManagementAgent.Connectors.Count; //Provision to AD if (0 == Connectors) { DN = ManagementAgent.EscapeDNComponent("CN=" + mventry["displayName"].Value).Concat("OU=ECMA2,DC=corp,DC=contoso,DC=com"); csentry = ManagementAgent.Connectors.StartNewConnector("user"); csentry.DN = DN; csentry["samAccountName"].Value = mventry["accountName"].Value; csentry["employeeID"].Value = mventry["employeeID"].Value; csentry.CommitNewConnector(); } if (1 == Connectors) { } -
At the top, select Build and choose Build Solution from the drop-down. At the bottom, in the Output window you should see Build: 1 succeeded.
Enable Provisioning
In order to begin provisioning with the Synchronization Service, provisioning must be enabled. Use the steps below to enable provisioning.
To enable Provisioning
-
Back in the Synchronization Service, the options screen should still be up.
-
In the box next to Rule extension name:, click Browse. This will bring up the select File dialog.
-
Select MVExtension.dll and click OK.
-
Back on the options screen, place a check in Enable Provisioning Rules Extension.
