Export users in liferay


Sometimes it may require to export the users into CSV file to look into the depth of users details.

To make life easier, liferay has given such functionality to us, just by clicking the button. 

Navigate to the controlPanel and click on the users and Organization , there you will see a button "Export users". Click on the button to export the users. It will download a file called "User.csv"



But that csv file contains only 2 columns 

1. FullName
2. Email Id




But we require more fields to export like(screenName, jobTitle etc) so what to do?

Check the following entry in the portal.properties.

#
# Input a list of user attributes that will be included when exporting users
# to a CSV file. You can include custom fields by adding the prefix
# "expando:" to the attribute name.
#
users.export.csv.fields=fullName,emailAddress




Add the required entries by comma separated, If you want to know the what are the fields to be added look into the UserModelImpl.java class of the "TABLE_COLUMNS " field.

So we need additional screenName and jobTitle to export to CSV, so here we are adding to the property.

users.export.csv.fields=fullName,emailAddress,screenName,jobTitle

If you created the custom field/expando for user entity we can also export that entry also as like this "expando:<expando/custom name>"

Comments

  1. Hello!

    I'm trying to get this to work, however I cannot find the portal.properties file. Could you direct me a little to where I could find it?

    Thank You!

    ReplyDelete
  2. Portal.properties is found in "portal-impl.jar" in the path of src/portal.properties.

    Don't modify the portal.properties file directly.

    Create the "portal-ext.properties" file in the "tomcat-7.0.42\webapps\ROOT\WEB-INF\classes" path and override the properties required.

    ReplyDelete
  3. In the downloaded CSV Files, we need to give user credentials as well? how we will come to know which column is been referred for which data? Can i get a clarity on this pls? Also please let me know what has to be added in the portal-exe.properties.

    ReplyDelete
  4. In the downloaded CSV Files, we need to give user credentials as well? how we will come to know which column is been referred for which data? Can i get a clarity on this pls? Also please let me know what has to be added in the portal-exe.properties.

    ReplyDelete
    Replies
    1. This one,

      #
      # Input a list of user attributes that will be included when exporting users
      # to a CSV file. You can include custom fields by adding the prefix
      # "expando:" to the attribute name.
      #
      users.export.csv.fields=fullName,emailAddress

      For paasword

      It should be as

      users.export.csv.fields=fullName,emailAddress,password


      Hopes this helps.

      Delete

Post a Comment

Popular posts from this blog

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate

Opening portlet in popup