Hi,
I have following code to list all users:
users = people.getPeople(null, 0) for (var i=0; i<users.length; i++) { log = users[i].properties.userName + "\n"; logFile.content += log; }
However this does not work, I get an error on the log line.
I also tried users[i].properties["userName"], but that does not work either...
Solved! Go to Solution.
That's not a correct way. people api retruns scriptbale object so basically you get string valued nodeRefs.
You need to have actual node object in order to access properties.
Update the line to :
log = search.findNode(users[i]).properties.userName + "\n";
These are REST APIs you can use as well to get the same details:
V1 API: http://<host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/people
Repo Api: http://<host>:<port>/alfresco/service/api/people
people.isAccountEnabled() should work:
That's not a correct way. people api retruns scriptbale object so basically you get string valued nodeRefs.
You need to have actual node object in order to access properties.
Update the line to :
log = search.findNode(users[i]).properties.userName + "\n";
These are REST APIs you can use as well to get the same details:
V1 API: http://<host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/people
Repo Api: http://<host>:<port>/alfresco/service/api/people
Thanks!
How do I check if the user account is enabled? I tried
if (isAccountEnabled(search.findNode(users[i]).properties.userName))
but that does not work.
people.isAccountEnabled() should work:
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.