List Calendars in Nextcloud Calendar
One script reply has been approved by the moderators Verified

List all calendars a user has access to in Nextcloud calendar.

Created by marcel klehr12 595 days ago Picked 3 times
Submitted by nextcloud Python3
Verified 12 days ago
1
import caldav
2
import base64
3

4
# You can import any PyPi package.
5
# See here for more info: https://www.windmill.dev/docs/advanced/dependencies_in_python
6

7
# you can use typed resources by doing a type alias to dict
8
nextcloud = dict
9

10

11
def main(Nextcloud: nextcloud):
12
    headers = {}
13

14
    with caldav.DAVClient(
15
        url=Nextcloud['baseUrl'] + '/remote.php/dav/calendars/'+ Nextcloud['userId'] +'/',
16
        username=Nextcloud['userId'],
17
        password=Nextcloud['token'],
18
        headers=headers,
19
    ) as client:
20
        my_principal = client.principal()
21
        return my_principal.calendars()
22

23

Other submissions