Hallo André,
I guess that CALDAV is the way to go (via HTTPS, preferrably). There are
php snippets that demonstrate Web DAV accesses, for example, so you
could "roll your own", for both data read and write, and have full
flexibility to access single items, while keeping sogo happy with
synchronizing changed data to whichever user/program/device needs it.
For mere backups though, the SQL database dump would be the obvious choice.
I admit that for a certain purpose I was a bit lazy and used a database
dump: We need a plain csv file of phone number and associated names for
our PABX to display caller names. There is some script that I will not
disclose (as it is not pretty at all), but it is fed with the output of
echo "SELECT c_content FROM sogoanshoffm00112288562" | mysql -u
sogodbuser thesogodb | parsevcardscript
where the table name has been hand-picked, obviously, and the mysql uses
an options file (which contains the password in this case).
The data is - you may have guesses - in vcard format, which to me seems
like the shabby brother of an LDAP record - it seems to have been kind
of a standard for some time, or rather, a set of "we use it like this"
that are mostly compatible. Don't trust much on any application to
behave, and with a large range of software and devices accessing your
sogo, you will for example have several TEL;TYPE= and EMAIL;TYPE=
variants that not every program uses in the same way. YMMV.
For restoring the complete dataset, I had to do this with several SOGo
instances a while back when changing hardware, and on that occasion
doing a full software install instead of just moving the root partition.
Just shutting down sogo, exporting the database, importing on the new
server and firing up sogo there with the mostly identical config file
worked as expected.
Best regards
Anselm
Am 12.06.19 um 19:18 schrieb André Rodier (an...@rodier.me):
> Hello, wonderful SOGo team,
>
> I need a way to export and import an address book, and maybe a
> calendar, from the command line.
>
> I am interested even if your answer is partial, for instance just the
> export. The bare minimum would be exporting an address book in a text
> file, in any appropriate format.
>
> I am happy to write SQL as well if this is necessary, although I would
> prefer use the http protocol.
>
> Also, can I restore, still using the command line, the user's data from
> a SOGo backup, or the whole database is the way to go.
>
> Thanks a lot for your hard work, this is great, and thanks to you and
> Debian, my project is taking shape.
>
> Thanks a lot for your hard work and your insights.
--
users@sogo.nu
https://inverse.ca/sogo/lists