I had the same idea and solved the goal with a litte bit of my development skills. Sorry for my english, I am german.
My concept is to download the source calendar, modify every event to anonymize them and give them the title “-=busy=-”. Then upload the modified calendar to nextcloud, where this “busycalendar” is shared to the family memers needed.
Here are my solution steps:
- Download the source calendar as .ics file. This can be done easyly with the extension of “?export” after the CalDAV-URL - see link of the “Export-Button” in calendars settings (web-ui).
- Modify the downloaded ics-file with a search-and-replace tool. I used the following regular expressions:
- “SUMMARY:.*[^a]” replaced with “SUMMARY:-=busy=-”
- “DESCRIPTION:.*[^a]” replaced with “DESCRIPTION:”
- “LOCATION:.*[^a]” replaced with “LOCATION:”
- Uploading the modified ics-file to nexcloud by using a ics2caldav-importer. On github I found a php-solution: https://github.com/stefan-muc/caldav-calendar-import
- Automate the process by wrapping the steps above in a shell-script.
I’m not new in programming linux shell scripts and php, but last time I’ve done thomething like this is passing many years. So the code I produced is quick-and-dirty, has room for improvement but works fine for me.
This is the wrapper-script and you will adjust your needs:
#!/bin/sh
# get source .ics
echo "#1 get source .ics"
sudo -u http php82 [/var/www/html]/busycalendar/download_ics-file.php $1
# modify .ics to -=busy=-
echo "#2 modify .ics to -=busy=-"
sed -e "s/SUMMARY:.*[^a]/SUMMARY:-=busy=-/g" /var/tmp/export.ics > /var/tmp/export_1.ics
sed -e "s/DESCRIPTION:.*[^a]/DESCRIPTION:/g" /var/tmp/export_1.ics > /var/tmp/export_2.ics
sed -e "s/LOCATION:.*[^a]/LOCATION:/g" /var/tmp/export_2.ics > /var/tmp/export_busy.ics
# prepare .ics for import
echo "prepare .ics for import"
chmod 777 /var/tmp/export*.ics
# update busy-calendar via ics2caldav-importer
echo "#3 update busy-calendar via ics2caldav-importer"
sudo -u http php82 [/var/www/html]/busycalendar/calendar_import.php $1
# cleanup
echo "#4 cleanup"
rm /var/tmp/export*.ics
The called download_ics-file.php is a basic php-file-downloader script, witch accepts a optional given calendar-name as parameter 1:
<?php
if (isset($argv[1]))
{
echo "download .ics file from calendar: " . $argv[1];
}
//API KEY AND PASSWORD
$username = '[username]';
$password = '[password]';
$usernamePassword = $username . ':' . $password;
$headers = array('Authorization: Basic ' . base64_encode($usernamePassword), 'Content-Type: application/json');
//URL
$url = 'https://[nextcloud-host]/remote.php/dav/calendars/[username]/[calendar-name]/?export';
if (isset($argv[1]))
{
if ($argv[1] == '[calendar-name 1]') $url = 'https://[nextcloud-host]/remote.php/dav/calendars/[username]/[calendar-name 1]/?export';
if ($argv[1] == '[calendar-name 2]') $url = 'https://[nextcloud-host]/remote.php/dav/calendars/[username]/[calendar-name 2]/?export';
}
//FILE NAME
$filename = 'export.ics';
//DOWNLOAD PATH
$path = '/var/tmp/'.$filename;
/FOLDER PATH
$fp = fopen($path, 'w');
//SETTING UP CURL REQUEST
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
//CONNECTION CLOSE
curl_close($ch);
fclose($fp);
?>
The challenge with the caldav-importer script was, that the url for the ics-file to import is designed for WebDAV on the same nextcloud-host. But you can easy use a url without using WebDAV too. So I created a symbolc link to the modified ics-file, that is reachable directly via the webhost like this “https://[nextcloud-host]/busycalendar/export_busy.ics”.
When I bring all together, I created a cron job to call the wrapper script once a day. WHOOHAA! 
Be ispired of this solution and fork it. For example an only-php solution should be a better way. → The used caldav-importer script stores the events as VEVENT-objects (sabre/vobject) in a list. This list is processed for uploading via CalDAV by looping through this list. Here the anonymization should be done better.