Using occ to share userA's calendar with userB?

In NC21, is there a way I could use occ to share a user’s calendar with another user ?

Ideally, I would like the personal calendars of
userA, userB, userC… to be share with a given user (“main_user”)

Obviously I can do it using the web interface but it is time consuming.
Any idea how to solve this problem ?

Hi @vmunich77

You could do it the other way arround. Create the calendars in the “main_user” account and share them from there with the relevant users who need access.

Hi bb77, thanks for your message.

Yes, but could I do this using occ ?
I could not find how to use occ to share users’s calendars in the documentation


No I don’t think thats possible.

I also found this with a quick google search…

Yes I found it too.
Too bad.
Thanks for your help.

If you follow @bb77 suggestion to create the calendar in the main users account you could share the calendars via a POST-request with curl (you need the main users password though):

#!/usr/bin/env bash

set -euo pipefail

### begin variable declaration

# Nextcloud-URL (add subdirectory, if Nextcloud is not in webroot):

# username who shares the calendar:

# name of the calendar to be shared:

# username with whom the calendar will be shared:

# calendar access privileges for the sharee ("read-write" or "read")

### end of variable declaration

# create URL to calendar (set together with variables declared before):

# prepare data for POST request:
  <x4:share xmlns:x4="">
      <x0:href xmlns:x0="DAV:">principal:principals/users/'${sharee}'</x0:href>

# POST request to share the calendar $calendar from $user with $sharee
curl -sS -f -k -u "${user}:${user_password}" -H "Content-Type: application/xml; charset=utf-8" -X POST "${calendar_url}" -d "${data}"

printf '%s\n' "${user}s' calendar '${calendar_name}' successfully shared with '${sharee}'."

exit 0