cancel
Showing results for 
Search instead for 
Did you mean: 

list of all users

kriton
Champ in-the-making
Champ in-the-making
How can I get a list of all users in the system ? I've tried people.getPeople(null) but it doesnt work. It returns a collection of nodes that seem to be invalid as they have no properties and nothing that I can use to refer to a user.

I need this to make a script to export all user in .csv format.
2 REPLIES 2

cibex
Champ in-the-making
Champ in-the-making

var strLogFile = "userlist.txt"
//this folder must exist!
var logFolder = companyhome.childByNamePath("/Data Dictionary/Logs");
var logFile = logFolder.childByNamePath(strLogFile);
if (logFile == null) {logFile = logFolder.createFile(strLogFile);
}
logFile.content = "";

var peopleFound = people.getPeople(null);
for (i = 0; i < peopleFound.length; i++) {
  username = search.findNode(peopleFound).properties.userName;
  //logger.log(username);
 
 
  objPerson = people.getPerson(username);
  //comment following line (and closing "}" ), to list all users
  if(people.isAccountEnabled(username)){
  logger.log(objPerson.properties.lastName + ";" +objPerson.properties.firstName + ";" + objPerson.properties.userName + ";" + objPerson.properties.email + ";" + people.isAccountEnabled(username));
  logFile.content += objPerson.properties.lastName + ";" +objPerson.properties.firstName + ";" + objPerson.properties.userName + ";" + objPerson.properties.email + ";" + people.isAccountEnabled(username) + "\n"
  }
}