Csv import: Difference between revisions

From Open-Xchange
No edit summary
Line 7: Line 7:
Note: The first line defines the fields and have to be in every file you want to
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.
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.
=== Importing users to an existing context ===
<pre>adminuser,adminpass,contextid,username,displayname,givenname,surname,password,email,imaplogin,imapserver,smtpserver,quota,access-combination-name,language,timezone
oxadmin110,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
oxadmin110,secret,110,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</pre>
oxadmin110 is the adminuser of the context 110 with the password secret. There will be 2 users  imported to the context (110), pete_test and sandra_linux. To import the users:
$ /opt/open-xchange/sbin/createuser --csv-import myuserlist.csv


=== Generate new contexts  ===
=== Generate new contexts  ===
Line 31: Line 22:
This will make two new contexts, 110 with pete_test and 111 with as the contextadmin and the only user.
This will make two new contexts, 110 with pete_test and 111 with as the contextadmin and the only user.


To import the contexts/users from the csv file:
To create the contexts from a CSV file:
 
$ /opt/open-xchange/sbin/createcontext -A oxadminmaster -P secret --csv-import contexts_list.csv


  $ /opt/open-xchange/sbin/createcontext -A oxadminmaster -P secret --csv-import myuserlist.csv
=== Importing users to an existing context ===
<pre>adminuser,adminpass,contextid,username,displayname,givenname,surname,password,email,imaplogin,imapserver,smtpserver,quota,access-combination-name,language,timezone
oxadmin110,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
oxadmin110,secret,110,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</pre>
 
oxadmin110 is the adminuser of the context 110 with the password secret. There will be 2 users  imported to the context (110), pete_test and sandra_linux. To import the users:
 
  $ /opt/open-xchange/sbin/createuser --csv-import myuserlist.csv


=== Definitions ===
=== Definitions ===

Revision as of 13:34, 24 August 2011

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:

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.

Generate new contexts

If you need to initially create new contexts into OX via CSV import functionality, you have to create CSV data which cover the context informations and also the informations which are needed for the context admin user.

In general, if you want to let the context admin use the OX GUI too, you also have to set mail.properties:com.openexchange.mail.adminMailLoginEnabled=true

in the file /opt/open-xchange/etc/groupware/mail.properties

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

This will make two new contexts, 110 with pete_test and 111 with as the contextadmin and the only user.

To create the contexts from a CSV file:

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

Importing users to an existing context

adminuser,adminpass,contextid,username,displayname,givenname,surname,password,email,imaplogin,imapserver,smtpserver,quota,access-combination-name,language,timezone
oxadmin110,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
oxadmin110,secret,110,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

oxadmin110 is the adminuser of the context 110 with the password secret. There will be 2 users imported to the context (110), pete_test and sandra_linux. To import the users:

$ /opt/open-xchange/sbin/createuser --csv-import myuserlist.csv

Definitions

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