Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 Active Directory Issue

$
0
0
Hi guys,

Whenever I run my code I get an invalid dn syntax error? Any suggestions? I am attempting to add a newly created member to a distribution group.

There does not seem to be an issue with having a space in the full name as I am creating the users with the same setup.

Any help would be great !

Code:

       
        groupDn = "OU=GmailGroups,DC=GBS,DC=local"
        Dim fullName As String = frmMain.tLast.Text & " " & frmMain.tFirst.Text
        Dim newUser As DirectoryEntry = dirEntry.Children.Add("CN=" & fullName, "user")

        'Add Groups
        Dim grp As DirectoryEntry
        Dim AD As DirectoryEntry = New DirectoryEntry("LDAP://" & groupDn)
        grp = AD.Children.Find("ADL_GAE", "group")

        If Not String.IsNullOrEmpty(grp.Name) Then
            grp.Invoke("Add", New Object() {newUser})
        End If


Viewing all articles
Browse latest Browse all 27189

Trending Articles