Export (0) Print
Expand All

Appendix B: MV Extension Source Code

Appendix B: MV Extension Source Code


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)
        {
            ConnectedMA ManagementAgent;
            int Connectors = 0;
            CSEntry csentry;
            ReferenceValue DN;

            ManagementAgent = mventry.ConnectedMAs["ImportTest"];
            Connectors = ManagementAgent.Connectors.Count;
            

            if (0 == Connectors)
            {
                csentry = ManagementAgent.Connectors.StartNewConnector("Person");
                csentry["anchor-attribute"].Value = mventry["employeeID"].Value;
                csentry["objectclass"].Value = "Person";
                csentry["delta"].Value = "Add";
                csentry.CommitNewConnector();
            }

            if (1 == Connectors)
            {
            }

            ManagementAgent = mventry.ConnectedMAs["AD"];
            Connectors = ManagementAgent.Connectors.Count;
            

            if (0 == Connectors)
            {
                DN = ManagementAgent.EscapeDNComponent("CN=" + mventry["accountName"].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.CommitNewConnector();
            }

            if (1 == Connectors)
            {
            }

        }

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


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

Community Additions

ADD
Show:
© 2014 Microsoft