08-08-2022 05:27 AM
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...
08-08-2022 04:45 PM
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
08-17-2022 01:32 PM
people.isAccountEnabled() should work:
08-08-2022 04:45 PM
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
08-17-2022 08:56 AM
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.
08-17-2022 01:32 PM
people.isAccountEnabled() should work:
Explore our Alfresco products with the links below. Use labels to filter content by product module.