Hi Experts
This is a simple question to somebody :o)
If the code
Dim objOU
objOU = GetObject("LDAP://cn=stuar
t 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.Connec
tion")
objConnection.Open("Provid
er=ADsDSOO
bject;")
objCommand = CreateObject("ADODB.Comman
d")
objCommand.ActiveConnectio
n = objConnection
objCommand.CommandText = "<LDAP://dc=mydomain,dc=or
g,dc=UK>;(
&(objectCa
tegory=Use
r)" & _
"(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=stuar
t 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