Hello together
I have the problem, if I created an user in the AD and I like to rename it,
I can change any properties of the user but in the AD-List there are no
changes. If I like to rename that, I have to right-click on the user an
select "rename". After that, an new window appears with the properties Full
name, First name, Last name, Display name and the user logon names. If I
change the value at "Full name", the name has changed in the overview list in
the AD.
So, my problem is now, to do exactly this with LDAP. Here the code:
1 Private Sub AddADPerson_Do()
2
3 Dim de As New DirectoryEntry(mstrLoginADSConnectionString,
mstrLoginUserID, mstrLoginKennwort)
4 Dim ou As DirectoryEntry = de.Children.Find("CN=Users")
5 Dim dirNewUser As DirectoryEntry = ou.Children.Add("CN=" &
mstrUserID, "User")
6
7
8 If Len(strsamaccountname) 0 Then
9 Call ADSUserSearchRead()
10 End If
11
12 If bolSearchResultExist = False Then
13 If Len(strsamaccountname) 0 Then
14 dirNewUser.Properties("sAMAccountname").Value = strsamaccountname
15 dirNewUser.Properties("userPrincipalName").Value =
strsamaccountname & "@" & strDomain & "." & strTopLevelDomain
16 End If
17 If Len(strsn) 0 Then dirNewUser.Properties("sn").Value = strsn
18 If Len(strgivenname) 0 Then
dirNewUser.Properties("givenName").Value = strgivenname
19 If Len(strc) 0 Then dirNewUser.Properties("c").Value = strc
20 If Len(strcompany) 0 Then
dirNewUser.Properties("Company").Value = strcompany
21 If Len(strl) 0 Then dirNewUser.Properties("l").Value = strl
22 If Len(strpostalcode) 0 Then
dirNewUser.Properties("postalCode").Value = strpostalcode
23 If Len(strpostalcode) = 0 Then
dirNewUser.Properties("postalCode").Value = " "
24 If Len(strstreetaddress) 0 Then
dirNewUser.Properties("streetAddress").Value = strstreetaddress
25 If Len(strmobile) 0 Then dirNewUser.Properties("mobile").Value
= strmobile
26 If Len(strmobile) = 0 Then dirNewUser.Properties("mobile").Value
= " "
27 If Len(strtelephonenumber) 0 Then
dirNewUser.Properties("telephonenumber").Value = strtelephonenumber
28 If Len(strtelephonenumber) = 0 Then
dirNewUser.Properties("telephonenumber").Value = " "
29 If Len(strhomephone) 0 Then
dirNewUser.Properties("homePhone").Value = strhomephone
30 If Len(strhomephone) = 0 Then
dirNewUser.Properties("homePhone").Value = " "
31 If Len(strgivenname) 0 And Len(strsn) 0 Then
32 dirNewUser.Properties("displayName").Value = strgivenname & " "
& strsn
33 ElseIf Len(strgivenname) 0 And Len(strsn) = 0 Then
34 dirNewUser.Properties("displayName").Value = strgivenname
35 ElseIf Len(strgivenname) = 0 And Len(strsn) 0 Then
36 dirNewUser.Properties("displayName").Value = strsn
37 Else
38 dirNewUser.Properties("displayName").Value = ""
39 End If
40
41 If Len(strgivenname) 0 And Len(strsn) 0 Then
dirNewUser.Properties("cn").Value = strgivenname & " " & strsn
42
43 dirNewUser.CommitChanges()
44
45 End If
46
47 End Sub
OIn line 41 I try to change it, but if I do that, the Error "An invalid dn
syntax has been specified. " appears.
Do you know what is wrong?
Thanks, Flubber 1 1684
Dim dirNewUser As DirectoryEntry = ou.Children.Add("CN=" & strgivenname & " "
& strsn, "User")
That was the solution ;)
"Flubber" wrote:
Hello together
I have the problem, if I created an user in the AD and I like to rename it,
I can change any properties of the user but in the AD-List there are no
changes. If I like to rename that, I have to right-click on the user an
select "rename". After that, an new window appears with the properties Full
name, First name, Last name, Display name and the user logon names. If I
change the value at "Full name", the name has changed in the overview list in
the AD.
So, my problem is now, to do exactly this with LDAP. Here the code:
1 Private Sub AddADPerson_Do()
2
3 Dim de As New DirectoryEntry(mstrLoginADSConnectionString,
mstrLoginUserID, mstrLoginKennwort)
4 Dim ou As DirectoryEntry = de.Children.Find("CN=Users")
5 Dim dirNewUser As DirectoryEntry = ou.Children.Add("CN=" &
mstrUserID, "User")
6
7
8 If Len(strsamaccountname) 0 Then
9 Call ADSUserSearchRead()
10 End If
11
12 If bolSearchResultExist = False Then
13 If Len(strsamaccountname) 0 Then
14 dirNewUser.Properties("sAMAccountname").Value = strsamaccountname
15 dirNewUser.Properties("userPrincipalName").Value =
strsamaccountname & "@" & strDomain & "." & strTopLevelDomain
16 End If
17 If Len(strsn) 0 Then dirNewUser.Properties("sn").Value = strsn
18 If Len(strgivenname) 0 Then
dirNewUser.Properties("givenName").Value = strgivenname
19 If Len(strc) 0 Then dirNewUser.Properties("c").Value = strc
20 If Len(strcompany) 0 Then
dirNewUser.Properties("Company").Value = strcompany
21 If Len(strl) 0 Then dirNewUser.Properties("l").Value = strl
22 If Len(strpostalcode) 0 Then
dirNewUser.Properties("postalCode").Value = strpostalcode
23 If Len(strpostalcode) = 0 Then
dirNewUser.Properties("postalCode").Value = " "
24 If Len(strstreetaddress) 0 Then
dirNewUser.Properties("streetAddress").Value = strstreetaddress
25 If Len(strmobile) 0 Then dirNewUser.Properties("mobile").Value
= strmobile
26 If Len(strmobile) = 0 Then dirNewUser.Properties("mobile").Value
= " "
27 If Len(strtelephonenumber) 0 Then
dirNewUser.Properties("telephonenumber").Value = strtelephonenumber
28 If Len(strtelephonenumber) = 0 Then
dirNewUser.Properties("telephonenumber").Value = " "
29 If Len(strhomephone) 0 Then
dirNewUser.Properties("homePhone").Value = strhomephone
30 If Len(strhomephone) = 0 Then
dirNewUser.Properties("homePhone").Value = " "
31 If Len(strgivenname) 0 And Len(strsn) 0 Then
32 dirNewUser.Properties("displayName").Value = strgivenname & " "
& strsn
33 ElseIf Len(strgivenname) 0 And Len(strsn) = 0 Then
34 dirNewUser.Properties("displayName").Value = strgivenname
35 ElseIf Len(strgivenname) = 0 And Len(strsn) 0 Then
36 dirNewUser.Properties("displayName").Value = strsn
37 Else
38 dirNewUser.Properties("displayName").Value = ""
39 End If
40
41 If Len(strgivenname) 0 And Len(strsn) 0 Then
dirNewUser.Properties("cn").Value = strgivenname & " " & strsn
42
43 dirNewUser.CommitChanges()
44
45 End If
46
47 End Sub
OIn line 41 I try to change it, but if I do that, the Error "An invalid dn
syntax has been specified. " appears.
Do you know what is wrong?
Thanks, Flubber This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joeri KUMBRUCK |
last post by:
Hello,
I'm trying to create an ASP page where users can type in a username
and password, and these credential should be checked with active
directory. If username and password are correct, the...
|
by: Joeri KUMBRUCK |
last post by:
Hello,
I'm trying to create an ASP page where users can type in a username
and password, and these credential should be checked with active
directory. If username and password are correct, the...
|
by: Mike |
last post by:
Greetings,
I am writing an Intranet application in ASP.NET using VB.NET. I am
obtaining the username of the user with:
uName = User.Identity.Name, which is in the form of DOMAIN\username. I...
|
by: Joeri KUMBRUCK |
last post by:
Hello,
I'm trying to create an ASP page where users can type in a username
and password, and these credential should be checked with active
directory. If username and password are correct, the...
|
by: John Dalberg |
last post by:
I want to automate the process of logging into an intranet. I want to pull
out the username of the Windows user logged into the machine running the
browser and use the username in my app. How can I...
|
by: B111Gates |
last post by:
OK I know this is a complex question so I will break it up.
I know that SSPI is the prefered method of authentication, however if I
use the sample provide by MS I cannot authenticate across...
|
by: None |
last post by:
Hi,
I have written a c# code to find the given username and password is
correct or not. (i.e the given username and password will be checked
against the active directory) But i don't know how...
|
by: Grant Merwitz |
last post by:
Is it possible to do an anonymous lookup in active directory through a web
page?
I am running a site with Domain Authentication activated.
I am looking up a users email address in Active...
|
by: dorrit.Riemenschneider |
last post by:
I need to validate a user with username and password against our
OpenLDAP active directory. This is my code:
Private bool ValidateUser (string username, string password)
{
DirectoryEntry...
|
by: Lookin4Toons |
last post by:
Trying to create a text box w/user input to enter a suggested user name and query AD to see if the name is available. This is for HR users who do not have access to the Admin tools to open the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |