cancel
Showing results for 
Search instead for 
Did you mean: 

how to get user home space via scheduler job

shay
Champ in-the-making
Champ in-the-making
Hi,

i have a scheduler job and i want the get the current user's home space when the job runs.
how can i get it?.

i tried to use the
User user = Application.getCurrentUser(context);
String homeSpaceID = user.getHomeSpaceId();
but since i run it from a scheduler i don't know how to get the FacesContext object.

Thanks in advance,
Shay.
1 REPLY 1

kevinr
Star Contributor
Star Contributor
That's web-client code - it can only run within the context of a JSF page.

You can use the AuthenticationService to get the current user name with getCurrentUserName(), then use the PersonService to lookup the noderef that represents the associated Person node. And finally get the cm:homeFolder property from the Person node - that contains the NodeRef to the user home folder.

Thanks,

Kevin