Nextcloud only syncing Calendars

Contants will sync if the connection is set up correctly. From my experience contact synch is reliable only from cloud to phone. Contacts created on phone can lead to duplicates in the cloud, at least in my case. I avoid that.

File synchronization (for pictures, videos) may be set up using the SailSync ownCloud app from Openrepos. This is my most-used app I think, it works very well in both directions. Very reliable even with folder structures containing thousands of files.

1 Like

I’m going to check out SailSync ownCloud but have to say that is kind of the functionality one would expect in the built in client too :disappointed:

What do you mean by “if the connection is set up correctly”? Should I just be adding a CardDAV account in addition to the Nextcloud account?

I have years of contacts on my phone (migrated from Symbian → nokia n900 → JP1 → n9 → JP1 → X → 10ii) and phone → nextcloud would be the direction I want.

There’s no need to set up an additional Carddav account, simply check contacts sync in Nextcloud account settings. Maybe it’s necessary to add account details such as webdav paths (advanced settings). However, in my case contacts synchronization works with default settings, without any address book path.
I have also a long history of contacts, but I never rely on a phone as a single point of truth for such important data. Instead, I have always had some cloud to store them, be it “Nokia Suite”, MS Exchange, or now Nextcloud. My phone is only one device that synchronizes data with that cloud.

IIRC I had to export all contacts from my phone, import them to NextCloud, remove the contacts from my phone and then add the account. There’s no (easy) way to move a contact from one storage to another in-phone.

And, when you add new contacts, make sure the correct storage is selected on the dialog.

Once it’s set up, it works very well!

1 Like

I’m starting to suspect there is an issue with nextcloud because my wifes Android device also does not sync it’s contacts, will check with some other clients.

This is what I recently had to do as well. I also had to export the ‘Personal Calendar’ on the phone, import to NC and then sync.

For syncing other things, I wanted more control, so I’m using rclone like:

but I have another endpoint in addition for NC. I organize images, for instance, in folders so simple syncing isn’t for me.

EDIT: [Guide/Hack] Automatic Nextcloud file sync when directory contents change - #11 by nephros is a nice overview fro nextcloud from @nephros

gnome-contacts was able to enumerate and show the contents of the nextcloud addressbooks without any issues.

From trailing logs on my server I see that my phone (SFOS) is enumerating the various available addressbooks but then it doesn’t do anything with them, I also tried to pin the phone to a specific address book and it enumerates it but it does not push contacts to said address book or pull them from there.

Is there some log on the phone that reports on these sync attempts?
@vige

It seems to me that my expectation of CardDAV was wrong, basically the nextcloud address book(s) act as additional address books on the phone just like they are additional Calendars, so what is on the phone stays on the phone while what is on Nextcloud or created on the phone set to Nextcloud will sync there.

I’m now digging through contacts.db to see if I can modify it to quickly have all my contacts migrated to Nextcloud.

I think my mistaken perception came from a time that I setup a google account and forgot to make it sync one way and e-mail only and thus violated the privacy of the part of my address book that got uploaded, which does suggest that this could be possible for Nextcloud too.

Lastly from my initial inspection of contacts.db it looks like by not specifying a single address book for the phone to use items will get duplicated since Nextcloud shares some automated address books like “Recently Contacted”, thus it may be wise to adjust the Advanced settings and point the phone only at a specific Address book or (if a Jolla dev is here) maybe add an interface similar to the Calendars where you chose which of the address books should sync.

1 Like

Initial very promising find:

I modified one contact in the database in a very minor way and it appeared on Nextcloud after reboot + sync (I reboot to make sure the changed db is active).

Every contact has (at least) 2 entries in contacts.db one defining where it is stored and one “aggregate”, both are different “collections”, by only changing the collectionId in the Contacts table to refer to Nextcloud instead of local storage it was “moved” and after a sync happened it indeed appeared on Nextcloud.

I ran the following query:

update Contacts set collectionId = 36 where collectionId = 2;

By me 36 is a Nextcloud address book and 2 local storage.

It seems to have mostly worked, though I still need to do some sampling of contacts to make sure information wasn’t lost (I have a backup of contacts.db of course).

2 Likes

The saga continues, the above method does not generate entries in the syncTarget table thus contact get duplicated every time a sync runs on the nextcloud side.

That sounds like a bug in the sync code… If an entire table is missing, sync should either not work and error out, or create the table and continue then…

It requires quite a lot of manual database work to iccur, but still.

I tentatively agree though not for the reason you think, the table is not missing but rather no entries are generated for all the contacts, so the contacts that I created on Nextcloud as a test or on my phone in the Nextcloud address book all have this, I’m not 100% but I think even the single contact that I changed at the beginning to to test if the method would be viable has it.

If the last sentence is true then the bug happens when more than a single contact get synced to Nextcloud (and as far as I recall way back when I tried to have this with different groupware also other carddav).

I’ll be resetting my contacts.db and Nextcloud contacts to test my hypothesis.

1 Like

I misread your post, sorry about that. Yes, the table is empty, not completely missing.

Let’s see what you end up with. I just realized that I have a spare SFOS device and a self-hosted Nextcloud, so I can easily poke around and test your findings too!

I have so far done a test with a single contact and 2 contacts, both cases resulted in syncTargets entries.

11 Contacts also worked.

So far I have only tried non-aggregate contacts, I also have some aggregates maybe the issue is there.

A single aggregate contact syncs, though it syncs wrong, the aggregated number syncs as a standalone number without details.

(Although that aggregate was also messed up on the phone I just remembered, it actually hid the orginal number that I linked a second number to)

I have tried several contacts containing special characters in their names also no luck.

It seems that when doing small piece meal amounts I am not able to hit this bug, but after again doing a bulk enable the bug was triggered.

Some more findings:

  1. Groups of 50 contacts work more seems to fail but that is a tentative observation
  2. I have found a contact that was problematic for sync and it’s an aggregate with a complicated history, I have many such contacts and am currently unsure how to “detect” them based on the database itself.

The contact is from the Symbian days, when I would heavily use labels and I would put husbands and wives and kids of families in the same contact with different labels, after the move to SFOS the label information was lost and from time to time when I would often have to call multiple times to reach who I wanted to reach I started splitting those contacts and renaming them from family name to specific persons in those families.

The contact is part of an aggregate but the other part of the aggregate is not adjacent so not part of the sync attempt, I’ll now try to enable both/all parts of the aggregate to see what happens.