Can't retrieve calendar information using PHP Sabre/Dav

Support intro

I’m new to nextcloud and webdav/caldav. Just created a free account on Nextcloud and trying to get calendar info from my account using PHP (Sabre). but it doesn’t work. Let me show some code:.

include 'vendor/autoload.php';

use Sabre\DAV\Client;

$settings = [
    'baseUri' => "https://example.thegood.cloud/remote.php/dav/",
    'userName' => "my@mail.com",
    'password' => "secret"
];

try {
	
	$client = new Client($settings);

	$response = $client->request(
		'GET', 'calendars/my@mail.com/CalendarName'
	);

} catch (\Exception $e) {
	echo $e->getMessage() . PHP_EOL;
}

When I use 'calendars/my@mail.com/CalendarName' to fetch the calendar information, it doesn’t work and shows following error:

Array
(
    [0] => Array
        (
            [body] => 

  Sabre\DAV\Exception\NotFound
  Node with name 'Personal' could not be found


            [statusCode] => 404
            [headers] => Array (
        )
        // ...
    )
)

But when I use files/my@mail.com/filename, it works. So, this works:

$client->request(
    'GET',  
    'https://example.thegood.cloud/remote.php/dav/files/my@mail.com/filename'
);

But this doesn’t

$client->request(
    'GET',  
    'https://example.thegood.cloud/remote.php/dav/calendars/my@mail.com/CalendarName'
);

What am I doing wrong?

Thanks for your help :slight_smile:

Update

I have changed the calendar name from CalendarName to calendarname (there was a typo in the name, fixed it) and now I’m getting the following response:

[body] => This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.
            [statusCode] => 200

This might answer your question:

Thanks for your help, but this returns me:

Array
(
    [0] => 
)

Also, the example is about the files, I want to retrieve the calendar information.