How to: Change the ObjectClass Property

The following examples show how to change the value of the ObjectClass property of a CSEntry object. You can write to the ObjectClass property only in the Provision method.

Public Sub Provision( _
      ByVal mventry As MVEntry) _
   Implements IMVSynchronization.Provision

    Dim ManagementAgent As ConnectedMA
    Dim Connectors As Integer
    Dim csentry As CSEntry
    Dim vcObjectClass As ValueCollection


    ManagementAgent = mventry.ConnectedMAs("Some Management Agent")
    Connectors = ManagementAgent.Connectors.Count

    If 1 = Connectors Then

        ' Use the existing connector.
        csentry = ManagementAgent.Connectors.ByIndex(0)

        ' Convert the existing ObjectClass entries to a string array.
        vcObjectClass = Utils.ValueCollection(csentry.ObjectClass.ToStringArray())

        ' Add the auxiliary class to the string array and then
        ' set the ObjectClass to the modified string array.
        vcObjectClass.Add("new-aux-class")
        csentry.ObjectClass = vcObjectClass

    End If

End Sub
void IMVSynchronization.Provision (MVEntry mventry)
{
    ConnectedMA ManagementAgent;
    int Connectors;
    CSEntry csentry;
    ValueCollection vcObjecClass;
    
    ManagementAgent = mventry.ConnectedMAs["Some Management Agent"];
    Connectors = ManagementAgent.Connectors.Count;
    
    if(1 == Connectors)
    {

        // Use the existing connector.
        csentry = ManagementAgent.Connectors.ByIndex[0];
        
        // Convert the existing ObjectClass entries to a string array.
        vcObjecClass = Utils.ValueCollection(csentry.ObjectClass.ToStringArray());
        
        // Add the auxiliary class to the string array and then
        // set the ObjectClass to the modified string array.
        vcObjecClass.Add("new-aux-class");
        csentry.ObjectClass= vcObjecClass;
    }
}

See Also

Reference

CSEntry
ObjectClass
Provision

Concepts

Rules Extensions Examples
Provisioning Objects in the Connector Space