T
Tom G
I am trying to retrieve the user's Display Name from an Active Directory
using JScript. I've looked at the example in Lab15 referenced elsewhere in
this Discussion Group, but it doesn't contain a JScript example. I'm trying
to translate, but I can't figure out how to use DirectorySearcher In JScript,
(not even sure if I can). My code is below. I'd appreciate your help.
Thanks.
var projectManager =
XDocument.DOM.selectSingleNode("my:riskReport/my
rojectManager");
if (projectManager.text == "") {
// get current user name
var WSHNetwork = new ActiveXObject('WScript.Network');
var strUserName = WSHNetwork.UserName;
// search for user whose mailNickname is the logon name
var ds = new DirectorySearcher("(mailNickname=" + strUserName + ")");
var result = ds.FindOne();
// get user's display name
if(result != null){
var employeeEntry = result.GetDirectoryEntry();
var strEmployeeName =
employeeEntry.Properties["displayName"].Value.ToString();
projectManager.text = strEmployeeName;
}
using JScript. I've looked at the example in Lab15 referenced elsewhere in
this Discussion Group, but it doesn't contain a JScript example. I'm trying
to translate, but I can't figure out how to use DirectorySearcher In JScript,
(not even sure if I can). My code is below. I'd appreciate your help.
Thanks.
var projectManager =
XDocument.DOM.selectSingleNode("my:riskReport/my
if (projectManager.text == "") {
// get current user name
var WSHNetwork = new ActiveXObject('WScript.Network');
var strUserName = WSHNetwork.UserName;
// search for user whose mailNickname is the logon name
var ds = new DirectorySearcher("(mailNickname=" + strUserName + ")");
var result = ds.FindOne();
// get user's display name
if(result != null){
var employeeEntry = result.GetDirectoryEntry();
var strEmployeeName =
employeeEntry.Properties["displayName"].Value.ToString();
projectManager.text = strEmployeeName;
}