Csv import

Revision as of 10:07, 24 August 2011 by Malasa (talk | contribs)

CSV import

It is possible to import a batch of users with the createuser/context tool to make the migration of existing data easier.

For this you need to export the userdata to a csv (Comma-Separated Values) file with the following structure:

adminuser,adminpass,contextid,username,displayname,givenname,surname,password,email,imaplogin,imapserver,smtpserver,quota,access-combination-name,language,timezone
pete_test,secret,110,pete_test,Pete Test,Pete,Test,secret,pete_test@mymailserver.org,pete_test,imap://imapserver:143,smtp://mailserver:25,1024,all,de_DE,Europe/Berlin
sandra_linux,secret,111,sandra_linux,Sandra  Linux,Sandra,Linux,secret,sandra_linux@mymailserver.org,sandra_linux,imap://imapserver:143,smtp://mailserver:25,1024,all,en_GB,Europe/London

Note: The first line defines the fields and have to be in every file you want to import. Due to linebreaks you will probably see more than 3 lines, just copy and paste the example to an editor of your choice or reduce the font size.

In a OX setup where users don't belong to the same group every user needs a context for the user. Since he is the only user, he should also be the contextadmin. This is the usual setup for email providers.

If the contextadmin is the only user, you also have to set

mail.properties:com.openexchange.mail.adminMailLoginEnabled=true

in the file /opt/open-xchange/etc/groupwaremail.properties

To import the contexts/users from the csv file:

$ /opt/open-xchange/sbin/createcontext -A oxadminmaster -P secret --csv-import myuserlist.csv

Language codes: you can use the same you have in the language menue for the user, like de_DE, en_GB, en_US, jp_JP ...

A list of timezones: Wikipedia:Zone.tab