Advertisement

05.06.2008 at 04:14PM PDT, ID: 23381228
[x]
Attachment Details

Convert VBscript to Visual Basic

Asked by stubar in Programming Languages, Visual Basic Programming

Tags: Visual Basic - Visual web developer

Hi Experts
This is a simple question to somebody :o)
If the code
Dim objOU
        objOU = GetObject("LDAP://cn=stuart test1,cn=users,dc=mydomain,dc=org,dc=UK")
        objOU.MoveHere("LDAP://cn=stuart test1,cn=users,dc=mydomain,dc=org,dc=UK", "cn=user1newcn")

Moves the CN (Common Name) and changes the CN in the process, what's the same code for visual basic? Because try as i might it will not accept MoveHere.

Full code as follows.
Option Explicit Off
Option Infer On

stUser = ("Stest1")
        username = stUser
        strUserName = stUser
        objConnection = CreateObject("ADODB.Connection")
        objConnection.Open("Provider=ADsDSOObject;")

        objCommand = CreateObject("ADODB.Command")
        objCommand.ActiveConnection = objConnection

        objCommand.CommandText = "<LDAP://dc=mydomain,dc=org,dc=UK>;(&(objectCategory=User)" & _
                 "(samAccountName=" & strUserName & "));samAccountName;subtree," & _
                    "CN, distinguishedName, streetaddress, st, telephonenumber, adspath, PhysicalDeliveryOfficeName, facsimileTelephoneNumber"

        objRecordSet = objCommand.Execute
        CN = objRecordSet("cn")
        Label1.Text = CN.value
        mydate = Today
        Label4.Text = Today
        adspath = objRecordSet("adspath")
        Label2.Text = adspath.value

        Dim objOU
        objOU = GetObject("LDAP://cn=stuart test1,cn=users,dc=mydomain,dc=org,dc=UK")
        objOU.MoveHere("LDAP://cn=stuart test1,cn=users,dc=mydomain,dc=org,dc=UK", "cn=user1newcn")
    End Sub

Start Free Trial
[+][-]05.07.2008 at 05:21AM PDT, ID: 21515563

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 08:45AM PDT, ID: 21534034

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming Languages, Visual Basic Programming
Tags: Visual Basic - Visual web developer
Sign Up Now!
Solution Provided By: stubar
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628