Link to home
Start Free TrialLog in
Avatar of nayel
nayelFlag for United Arab Emirates

asked on

VBscript Trim function does not work fine

i have VBScript code taking mail attribute from our active directory , i used Trim function to remove spaces from email value, but it not work allways i got some emails with its spaces.

here is lines from the script


objCommand.CommandText = "SELECT company,department,mail,userPrincipalName,Name,ADsPath,displayName,userCategory ,distinguishedName,sAMAccountName FROM 'LDAP://DC=aa,DC=uaeu,DC=ac,DC=ae' WHERE objectCategory='User' AND sAMAccountName='" & LDAPUserID & "'"  
	
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
	
Set objRecordSet = objCommand.Execute
 
UserEmail=LCase(objRecordSet.Fields("mail").Value)
UserEmail=Trim(UserEmail)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Aard Vark
Aard Vark
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial