Re: AD/ADAM Create User (VB.Net)



You might like ch 10 of our book to help with some of this stuff. It is
free from the website in my sig. There is also free VB.NET code on the site
from the book.

There are also a few ADAM specific things to do here. You need to specific
the application partition NC Name in your binding string in order for LDAP
to know where in ADAM to put the user:

LDAP://adamdnsname/OU=Users,O=myadampartition

(or whatever you created there)

Also, what is the value of strUser in the code below? It needs to be in
"RDN" format, ie "cn=someuser", assuming that you are creating an object
with the ADAM user schema and not something else.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"will" <will@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8C425E14-D43A-442F-A500-863F6DC68EE0@xxxxxxxxxxxxxxxx
I'm receiving the following error when attempting add a new user to the
AD.
The user account used have enterprise level rights. Any help would be
greatly
appreciated. Thanks! - Will

An invalid dn syntax has been specified. (Exception from HRESULT:
0x80072032)"

CODE:

Try
objADAM = New DirectoryEntry("LDAP://<domain>.com, "userid",
"password",
AuthenticationTypes.Secure)
objADAM.RefreshCache()
'
objUser = objADAM.Children.Add(strUser, "user")
objUser.Properties("displayName").Add(strDisplayName)
objUser.Properties("userPrincipalName").Add( _
strUserPrincipalName)
objUser.CommitChanges()
Catch ....

Dim lastname As String = "test"
Dim firstname As String = "user"
Dim email As String = "tuser@xxxxxxxxxxxxxxxxx"
'
strUser = "CN=" & lastname & "," & firstname
strDisplayName = lastname & "," & firstname
strUserPrincipalName = email






.



Relevant Pages

  • Re: AD/ADAM Create User (VB.Net)
    ... I'm confused about Active Directory and ADAM - they appear to be ... the application partition NC Name in your binding string in order for LDAP ... strUserPrincipalName) ... Dim firstname As String = "user" ...
    (microsoft.public.windows.server.active_directory)
  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Help answer these 70-310 questions
    ... One argument is the string ... Dim output As New StringBuilder ... EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcad)