I have import 1000 contacts via VCard 3.0 import to nc.
Now I want to mass add a group, but I don’t want to click each contact by contact and set the group manually.
Is it possible to set the group in bulk?
If is not possible by the GUI, perhaps it is possible with UPDATE command in the database?
You can do it using the CardDAV interface. Details here: https://sabre.io/dav/building-a-carddav-client/. The hardest part is constructing the query properly. Here’s a near sample (it’s taken from working code, but I’ve manually trimmed it down a bit and removed language-specific constructs, and so it may have errors). In my requirement, I was pulling data from NC, whereas you want to do updates, so you’ll have to read some to convert my example to match your need.
First, you need a URL for the NC server you want to reach. Here’s an example of what I used:
You’ll need some headers in there. When I send the HTTP request, I include headers declaring the content type as “application/x-www-form-urlencoded” and the depth as 1. You’ll also need to pass user credentials. In my case, I created a new user in NC just for this, and shared my contacts with that user.
Finally, for retrieval at least, I needed to send XML to describe what I needed. Here’s the XML I sent:
More details on the whole CardDAV interface is at the link I provided earlier in this post. Lots of bits and pieces there, but hopefully some of this will help get you going.
Just as a tip for anyone searching for this:
There is a great solution by accessing the contacts in NC via the emailer Thunderbird with the add-on called “Cardbook” installed.
Cardbooks allows for extremely easy manipulation of contact data.
Mass shifting of contacts between adress book sis not issue and it can also bulk assign categories.
Thank you much, cardbook is exactly what ive been looking for and perfect since im planning on mostly managing them from thunderbird but want them all synced through cardav to nextcloud so i can sync them down to my phone as well. I’m extremely surprised that there is nothing built into google contacts, or nextcloud contacts with the powerful editing capabilities that cardbook has.