Welcome to the mailbox.org user forum!
 

Access calendar data from programs using CalDav

Sahil Gautam shared this idea 59 days ago
Proposed

Hi, I have been a long term google calendar user, and I recently switched to mailbox.org due to work requirements. I report my work hours by fetching events from my calendar and organising them nicely using computer programs.


I tried really hard, searched through the internet, asked a few chatbots about how can I fetch data from my mailbox.org calendar. I found that I can use CalDav protocol to fetch my calendar events. The blog on "generic calendar access" asks to look for folder id "folder=22" etc. But in my case, I see the folder id as "&folder=cal://0/670". What should I specify for the folder ID in this case?

Replies (2)

photo
2

i use DAVx5 and the url is just https://dav.mailbox.org and it automatically detect my folder id

look at this guide if you need your personal folder id: https://kb.mailbox.org/en/private/calendar-article/caldav-and-carddav-for-other-devices/

photo
1

Thanks for the reply, I found my mistake. I was using the wrong url.


```

# Replace with your actual mailbox.org username and password

USERNAME="<email-address>"

PASSWORD="<email-password>" # this must be managed by gpg/keyring etc, for that I need to understand those


# mailbox.org WebDAV URL for calendar access

CALENDAR_URL="https://dav.mailbox.org/caldav/<calendar-id>" # right click on the calendar > properties > caldav url.


# Function to fetch all calendar events

fetch_all_calendar_events() {

curl -u "$USERNAME:$PASSWORD" -X REPORT --data '<?xml version="1.0" encoding="UTF-8" ?>

<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">

<d:prop>

<d:getetag />

<c:calendar-data />

</d:prop>

<c:filter>

<c:comp-filter name="VCALENDAR">

<c:comp-filter name="VEVENT" />

</c:comp-filter>

</c:filter>

</c:calendar-query>' -H "Depth: 1" -H "Content-Type: application/xml" "$CALENDAR_URL"

}


# Fetch and display the calendar events

echo "Fetching all calendar events from mailbox.org..."

response=$(fetch_all_calendar_events)


# Parse the XML response and extract the event details using xmllint

event_details=$(echo "$response" | xmllint --format -)


# Display the event details

echo "Calendar Event Details:"

echo "$event_details" > out


```

I was looking for something more like this.

Leave a Comment
 
Attach a file