20-07-23 01:26 PM
Dear Team,
Currently we have the System - Active Directory VBO as in which we can perform the Operations
like
Here I need help from you to create one page for getting the Active Directory (AD) user details like First Name, Last Name and Email Id of the user
Could you please help me on this?
Answered! Go to Answer.
21-07-23 06:05 AM
Hi Syed,
Can you try the below code stage to get the First Name, Last Name and Mail ID. You can refer the LDAP attribute names from here.
Input :
Output :
Code:
firstName = ""
lastName = ""
mailID = ""
Dim ds As New DirectoryServices.DirectorySearcher("(userPrincipalName=" & SearchString & ")")
ds.PropertiesToLoad.Add("givenName") ' First Name
ds.PropertiesToLoad.Add("sn") ' Last Name
ds.PropertiesToLoad.Add("mail") ' Mail
Exists = ds.FindOne() IsNot Nothing
Dim result As SearchResult = ds.FindOne()
If Exists Then
Dim properties As ResultPropertyCollection = result.Properties
' Get the first name, last name, mail attributes
firstName = properties("givenName")(0)?.ToString()
lastName = properties("sn")(0)?.ToString()
mailID = properties("mail")(0)?.ToString()
End If
21-07-23 06:05 AM
Hi Syed,
Can you try the below code stage to get the First Name, Last Name and Mail ID. You can refer the LDAP attribute names from here.
Input :
Output :
Code:
firstName = ""
lastName = ""
mailID = ""
Dim ds As New DirectoryServices.DirectorySearcher("(userPrincipalName=" & SearchString & ")")
ds.PropertiesToLoad.Add("givenName") ' First Name
ds.PropertiesToLoad.Add("sn") ' Last Name
ds.PropertiesToLoad.Add("mail") ' Mail
Exists = ds.FindOne() IsNot Nothing
Dim result As SearchResult = ds.FindOne()
If Exists Then
Dim properties As ResultPropertyCollection = result.Properties
' Get the first name, last name, mail attributes
firstName = properties("givenName")(0)?.ToString()
lastName = properties("sn")(0)?.ToString()
mailID = properties("mail")(0)?.ToString()
End If
23-07-23 01:52 PM
@Athiban Mahamathi Mathialagan
Thank you for your response.
14-09-23 09:27 AM
@Athiban Mahamathi Mathialagan
I'm not getting any results with the above code and it's sowing the Exist flag as false.
The user details already exist in the AD group.
14-09-23 03:19 PM
@Athiban Mahamathi Mathialagan
I'm getting the AD details with the below code
14-09-23 04:49 PM
Glad that it worked out.
30-07-24 06:14 PM
Hi
i need help with the code stage to extend the Active Directory object to be able to delete users and to set the expiry date on user accounts