Hi Team,
We are trying to import the users from the excel or csv file to specified group in AEM on AEM 6.4, I tried the steps mentioned in Adobe Experience Manager Help | Creating a custom Excel Service for Adobe Experience Manager but no luck , any pointers or alternate way to achieve it on AEM 6.4 ??
Solved! Go to Solution.
Views
Replies
Total Likes
This use case is very possible and be easy to do. You would need to write a custom AEM serviec that can read Excel. You can use the Java EXCEL API to do so. See this older artilce:
Scott's Digital Community: Creating a custom Excel Service for Adobe Experience Manager
Read all of the user data from the EXCEL doc, place in a Java collection object and then iterate through the collection and use the USER MANAGER API to create the users.
Views
Replies
Total Likes
Did you try to create users using the UserManager API? There is an example on Adobe help site. I am just copy-pasting the snippet here, please go throuhg the complete example to understand better.
Group group=userManager.createGroup(groupName,new SimplePrincipal(groupName),"/home/groups/test");
Value value=adminSession.getValueFactory().createValue("Sample Group", PropertyType.STRING);
group.setProperty("./profile/givenName", value);
value=adminSession.getValueFactory().createValue("Test Group", PropertyType.STRING);
group.setProperty("./profile/aboutMe", value);
value=adminSession.getValueFactory().createValue("abc@gmail.com", PropertyType.STRING);
group.setProperty("./profile/email", value);
You can read the csv file, iterate the rows and create the users
User user=userManager.createUser(userName, password,new SimplePrincipal(userName),"/home/users/test");
Value value=adminSession.getValueFactory().createValue("Issac", PropertyType.STRING);
user.setProperty("./profile/familyName", value);
value=adminSession.getValueFactory().createValue("Albin", PropertyType.STRING);
user.setProperty("./profile/givenName", value);
value=adminSession.getValueFactory().createValue("Test User", PropertyType.STRING);
user.setProperty("./profile/aboutMe", value);
value=adminSession.getValueFactory().createValue("albin@gmail.com", PropertyType.STRING);
user.setProperty("./profile/email", value);
Group group = (Group)(userManager.getAuthorizable(groupName));
group.addMember(userManager.getAuthorizable(userName));
Views
Replies
Total Likes
Thanks for your quick response.
Yes I tried the above link and able to add the user as mentioned, but I am looking for reading the users from the excel or csv file and adding to group.
Views
Replies
Total Likes
what error do you get in the article you shared? It should work fine, just use maven archetype 13+ and use the same code or if you want to convert the same to R6, that's also possible.
Views
Replies
Total Likes
Hi,
you could try to use a cURL command in order to import users into AEM.
You need to run something like the following command:
curl -u admin:admin -FcreateUser= -FauthorizableId=$UserNameReadFromCSV -Frep:password=$PasswordReadFromCSV http://localhost:4502/libs/granite/security/post/authorizables
Try as described here: cq5 - how import users to AEM/CQ from excel - Stack Overflow
Let us know.
Thanks,
Antonio
Views
Replies
Total Likes
This use case is very possible and be easy to do. You would need to write a custom AEM serviec that can read Excel. You can use the Java EXCEL API to do so. See this older artilce:
Scott's Digital Community: Creating a custom Excel Service for Adobe Experience Manager
Read all of the user data from the EXCEL doc, place in a Java collection object and then iterate through the collection and use the USER MANAGER API to create the users.
Views
Replies
Total Likes
Views
Replies
Total Likes
May be I am late to the party but I have been working on this requirement and created a utility in the AEM for the same.
This utility allows the users to upload an excel file with the user details and creates users in the AEM to the desired group automatically.
https://aem.redquark.org/2019/05/create-users-in-aem-from-excel-file.html
You can see the code for the same at my GitHub. I hope this helps someone.
Views
Replies
Total Likes
Views
Likes
Replies