Author Topic: [SOLVED] Contacts and Calendars in Database  (Read 460 times)

talkinggoat

  • Zen Apprentice
  • *
  • Posts: 22
  • Karma: +3/-0
    • View Profile
[SOLVED] Contacts and Calendars in Database
« on: July 25, 2017, 09:23:02 pm »
Does anyone know exactly where Zentyal 4.2x/SOGo stores the calendars and contacts for users and/or (depending on the answer) how to export them without using the user's web interface?
« Last Edit: July 27, 2017, 04:44:09 pm by talkinggoat »

talkinggoat

  • Zen Apprentice
  • *
  • Posts: 22
  • Karma: +3/-0
    • View Profile
Re: Contacts and Calendars
« Reply #1 on: July 27, 2017, 04:43:17 pm »
In the Sogo database, in MySQL, there are tables that correspond to each user's address book and calendar. The table, sogo_folder_info contains columns and rows that correspond to the correct user and table, in the database. In sogo_folder_info the column c_path2 contains the username of the person, c_path3 contains the type of entry, calendar or contact, c_foldername contains the name of the entry or what you named the address book / calendar and c_location is the table that has the records. c_location also has a corresponding c_quick_location and c_acl_location. You'll need all 3 of these "location" tables, as well as the row, corresponding to the user in question, from sogo_folder_info. Keep in mind, too, there is c_folder_id that might need to be changed, so it doesn't overlap with another user. c_path needs to be a unique name and c_path4 will be the final part from c_path. For instance, if c_path is /Users/joe/Calendar/100B-56440880-5-75095A00 then c_path4 will be 100B-56440880-5-75095A00

In order to move the address book and calendar from one installation to another, I simply used phpmyadmin to select the tables I wanted from the old database and exported them to an sql file. These will be the 3 tables listed in the c_location, c_quick_location and c_acl_location We'll call that export1.sql.

The next step was to create the row, with the keys, in the sogo_folder_info table. I selected that row, in phpmyadmin, and clicked Export. We'll call that export2.sql.

export1 does not need to be modified. It can be imported into the new database, without issue, unless tables already exist with the same names.

export2, however, probably needs to be modified:

First, you'll need to change c_folder_id to some unique number.

Second, you'll probably need to modify c_path to something unique. If you are importing /Users/joe/Contacts/personal, you'll need to change that trailing /variable to something else. If not, it will give you a duplicate warning in PRIMARY. Sogo makes paths in the form of 7C62-36475400-1-40F98080, so you should be able to make something by simply changing one number.

Third, you'll need to modify the c_location, c_quick_location and c_acl_location. Look at your other entries. They will have connection information, used to pull data out of the sql table. For instance, you are importing from a key that has mysql://sogo:EeO8Syso@127.0.0.1:3306/sogo/sogojoe0114ed50fd4, the database you are exporting from will not likely match the database you are exporting to. If the other rows of the database your are importing to have mysql://sogo:Fab554rvp@127.0.0.1:3306/sogo/sogojoe0114ed50fd4 You will need to modify the EeO8Syso to be Fab554rvp.

Finally, you will need to verify the c_location, c_quick_location and c_acl_location keys match the tables in the Sogo database, that hold the contact/calendar information. For instance, in the c_location column, if you have mysql://sogo:Fab554rvp@127.0.0.1:3306/sogo/sogojoe0114ed50fd4 there will be a table in the Sogo database called sogojoe0114ed50fd4, sogojoe0114ed50fd4_acl and sogojoe0114ed50fd4_quick If you imported them from export1, above, they should match and you won't have any issue.

Hope this helps. If anything is confusing, let me know and remember to BACK UP YOUR DATABASE before trying any of this.