# Provide custom app calendar

**URL:** <https://help.nextcloud.com/t/provide-custom-app-calendar/148753>\
**Category:** 💻 Development\
**Created:** [October 31, 2022, 4:49pm UTC](https://help.nextcloud.com/t/provide-custom-app-calendar/148753 "2022-10-31T16:49:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![susnux](https://help.nextcloud.com/user_avatar/help.nextcloud.com/susnux/32/47031_2.png) [@susnux](https://help.nextcloud.com/u/susnux)\
**Post date:** [October 31, 2022, 4:49pm UTC](https://help.nextcloud.com/t/provide-custom-app-calendar/148753/1 "2022-10-31T16:49:25Z")

</div>

I am currently trying to write a small app which provides a custom calendar,  
but after simply copying the code from the [documentation](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/groupware/calendar.html#calendar-providers) I can not get it working.

Basically only used the app template, changed the `Application.php`:

```php
public function register(IRegistrationContext $context): void {
		$context->registerCalendarProvider(\OCA\MyApp\Backend\CalendarProvider::class);
	}

```

And added a file `lib/Backend/CalendarProvider.php`

```php
<?php
namespace OCA\MyApp\Backend;

use OCP\Calendar\ICalendarProvider;
use Psr\Log\LoggerInterface;

class CalendarProvider implements ICalendarProvider {
	protected LoggerInterface $logger;
	
	public function __construct(LoggerInterface $logger) {
		$this->logger = $logger;
        $this->logger->debug('Construct!');
	}

	public function getCalendars(string $principalUri, array $calendarUris = []): array {
		$this->logger->debug('getCalendars', ['uri' => $principalUri]);
		return [];
	}
}

```

But neither the `__contruct` nor the `getCalendars` is ever called.  
(Also added some logic to provide custom calendars, but not relevant here)

I tried to find any working example, but the only app I could find providing custom calendars was the deck app, but that uses a completely different approach (using sabre DAV extensions directly).

So my question is, has someone sucessfully wrote an app providing custom calendars using the `ICalendarProvider` API? Or am I missing something?

---

_[View the full topic](https://help.nextcloud.com/t/provide-custom-app-calendar/148753)._
