Owncloud SQL manual export to .VCF & .ics

expert
oc-internals

#1

As I am stuck in the middle of a migration issue https://github.com/owncloud/core/issues/25722), before deleting everything, how can I export manually (SQL, PHPMyAdmin) my Contacts and Calendar items,
fr e.g.: I just need to export : SELECT fullname,carddata FROM contacts_cards WHERE addressbookid=3 ORDER BY contacts_cards.

as exporting from owncloud UI:
http:///owncloud/remote.php/carddav/addressbooks//contacts/
https:///owncloud/remote.php/caldav/calendars//defaultcalendar
doesn't work anymore :frowning:
Thank you


#2

You are right in the middle of a migration - any access will be blocked.
You can export your data as you intented id by running:

select * from oc_cards where addressbookid = 3

But what about fixing your installation and finished the migration properly as explained by @RealRancor in https://github.com/owncloud/core/issues/25722#issuecomment-238206637


#3

Because before Migrating anything I want to be sure I get my Contacts, and Caldendars items saved in a standard/open way.
so I got this SQL : SELECT fullname, carddata FROM contacts_cards WHERE addressbookid=2 ORDER BY fullname
but how can I export each rows in separated .vcf files ?

thank you


#4

I finally found the SQL statement :
SELECT carddata INTO OUTFILE '/MyDir/MyFile.Vcard' FROM contacts_cards WHERE id=1;
or even better : SELECT carddata INTO DUMPFILE '/MyDir/MyFile.Vcard' FROM contacts_cards WHERE id=1;
as outputs aren't the same format, choose which one suits you best.
You need also to be connected as "admin" or "root" to your DB otherwise you couln't write on the file system; code: mysql -u root -pPSSWORD YourDB (-p and your PASSWORD should be attached, not -u YourUser)

But I get only one .vcard, how to generate all my contacts in separated .vcard files?

Thank you


#5

Hi
could anyone help me by generating the batch or SQL script ?
Thank you