Export (0) Print
Expand All

Appendix C - Metaverse Extension Code

Published: December 23, 2009

Applies To: Windows Server 2008, Windows Server 2008 R2

The following is the metaverse extension code that is used in Step 12 - Run ACCOUNT MA Delta Import.

using System;
using Microsoft.MetadirectoryServices;

namespace Mms_Metaverse
{
    /// <summary>
    /// Summary description for MVExtensionObject.
    /// </summary>
    public class MVExtensionObject : IMVSynchronization
    {
        public MVExtensionObject()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        void IMVSynchronization.Initialize()
        {
            //
            // TODO: Add initialization logic here
            //
        }

        void IMVSynchronization.Terminate()
        {
            //
            // TODO: Add termination logic here
            //
        }

        void IMVSynchronization.Provision(MVEntry mventry)
        {
            provisionToAD(mventry);

         //   provisionToSQL(mventry);
        }

        bool IMVSynchronization.ShouldDeleteFromMV(CSEntry csentry, MVEntry mventry)
        {
            //
            // TODO: Add MV deletion logic here
            //
            throw new EntryPointNotImplementedException();
        }

        public void provisionToAD(MVEntry mventry)
        {
            ConnectedMA MA;
            int Connectors = 0;
            CSEntry csentry;
            ReferenceValue DN;


            MA = mventry.ConnectedMAs["RESOURCE"];
            Connectors = MA.Connectors.Count;
            DN = MA.EscapeDNComponent("CN=" + mventry["cn"].Value).Concat("OU=ResourceForestUsers,DC=resource,DC=fabrikam,DC=net");

            if (0 == Connectors)
            {
                csentry = MA.Connectors.StartNewConnector("user");
                csentry.DN = DN;

                csentry.CommitNewConnector();
               
            }

            if (1 == Connectors)
            {
            }


        }

        public void provisionToSQL(MVEntry mventry)
        {
            ConnectedMA MA;
            int Connectors = 0;
            string empID;
            CSEntry csentry;
            string sidHist;

            MA = mventry.ConnectedMAs["SQL"];
            Connectors = MA.Connectors.Count;
            empID = mventry["employeeID"].Value;
            sidHist = "N";

            if (mventry["sIDHistory"].IsPresent)
            {
                sidHist = "Y";
            }

            if (0 == Connectors)
            {
                csentry = MA.Connectors.StartNewConnector("person");
                csentry["EmpID"].Value = empID;
                csentry["SidHistoryPresent"].Value = sidHist;
                csentry.CommitNewConnector();
            }

            if (1 == Connectors)
            {
            }


        }
    }
}

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft