Nextcloud PHP API (master)

IManager

This class provides access to the Nextcloud CalDAV backend.

Use this class exclusively if you want to access calendars.

Events/Journals/Todos in general will be expressed as an array of key-value-pairs. The keys will match the property names defined in https://tools.ietf.org/html/rfc5545

[ 'id' => 123, 'type' => 'VEVENT', 'calendar-key' => 42, 'objects' => [ [ 'SUMMARY' => ['FooBar', []], 'DTSTART' => ['20171001T123456', ['TZID' => 'EUROPE/BERLIN']], 'DURATION' => ['P1D', []], 'ATTENDEE' => [ ['mailto:bla@blub.com', ['CN' => 'Mr. Bla Blub']] ], 'VALARM' => [ [ 'TRIGGER' => ['19980101T050000Z', ['VALUE' => DATE-TIME]] ] ] ], ] ]

Tags
since
13.0.0

Table of Contents

Methods

checkAvailability()  : array<string|int, IAvailabilityResult>
Check the availability of the given organizer and attendees in the given time range.
clear()  : void
removes all registered calendar instances
createEventBuilder()  : ICalendarEventBuilder
Create a new event builder instance. Please have a look at its documentation and the \OCP\Calendar\ICreateFromString interface on how to use it.
getCalendars()  : array<string|int, ICalendar>
getCalendarsForPrincipal()  : array<string|int, ICalendar>
handleIMipCancel()  : bool
Handle a iMip CANCEL message
handleIMipReply()  : bool
Handle a iMip REPLY message
handleIMipRequest()  : bool
Handle a iMip REQUEST message
isEnabled()  : bool
Check if calendars are available
newQuery()  : ICalendarQuery
Build a new query for searchForPrincipal
register()  : void
In order to improve lazy loading a closure can be registered which will be called in case calendars are actually requested
registerCalendar()  : void
Registers a calendar
search()  : array<string|int, mixed>
This function is used to search and find objects within the user's calendars.
searchForPrincipal()  : array<string|int, array<string|int, mixed>>
Query a principals calendar(s)
unregisterCalendar()  : void
Unregisters a calendar

Methods

checkAvailability()

Check the availability of the given organizer and attendees in the given time range.

public checkAvailability(DateTimeInterface $start, DateTimeInterface $end, IUser $organizer, array<string|int, string> $attendees) : array<string|int, IAvailabilityResult>
Parameters
$start : DateTimeInterface
$end : DateTimeInterface
$organizer : IUser

The organizing user from whose perspective to do the availability check.

$attendees : array<string|int, string>

Email addresses of attendees to check for (with or without a "mailto:" prefix). Only users on this instance can be checked. The rest will be silently ignored.

Tags
since
31.0.0
Return values
array<string|int, IAvailabilityResult>

Availabilities of the organizer and all attendees which are also users on this instance. As such, the array might not contain an entry for each given attendee.

clear()

removes all registered calendar instances

public clear() : void
Tags
since
13.0.0

createEventBuilder()

Create a new event builder instance. Please have a look at its documentation and the \OCP\Calendar\ICreateFromString interface on how to use it.

public createEventBuilder() : ICalendarEventBuilder
Tags
since
31.0.0
Return values
ICalendarEventBuilder

getCalendars()

public getCalendars() : array<string|int, ICalendar>

use \OCP\Calendar\IManager::getCalendarsForPrincipal

Tags
since
13.0.0
Return values
array<string|int, ICalendar>

getCalendarsForPrincipal()

public getCalendarsForPrincipal(string $principalUri[, array<string|int, string> $calendarUris = [] ]) : array<string|int, ICalendar>
Parameters
$principalUri : string

URI of the principal

$calendarUris : array<string|int, string> = []

optionally specify which calendars to load, or all if this array is empty

Tags
since
23.0.0
Return values
array<string|int, ICalendar>

handleIMipCancel()

Handle a iMip CANCEL message

public handleIMipCancel(string $principalUri, string $sender, string|null $replyTo, string $recipient, string $calendarData) : bool
Parameters
$principalUri : string
$sender : string
$replyTo : string|null
$recipient : string
$calendarData : string
Tags
since
25.0.0
Return values
bool

handleIMipReply()

Handle a iMip REPLY message

public handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData) : bool
Parameters
$principalUri : string
$sender : string
$recipient : string
$calendarData : string
Tags
since
25.0.0
Return values
bool

handleIMipRequest()

Handle a iMip REQUEST message

public handleIMipRequest(string $principalUri, string $sender, string $recipient, string $calendarData) : bool
Parameters
$principalUri : string
$sender : string
$recipient : string
$calendarData : string
Tags
since
31.0.0
Return values
bool

isEnabled()

Check if calendars are available

public isEnabled() : bool
Tags
since
13.0.0
Return values
bool

true if enabled, false if not

newQuery()

Build a new query for searchForPrincipal

public newQuery(string $principalUri) : ICalendarQuery
Parameters
$principalUri : string
Tags
since
23.0.0
Return values
ICalendarQuery

register()

In order to improve lazy loading a closure can be registered which will be called in case calendars are actually requested

public register(Closure $callable) : void

use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider

Parameters
$callable : Closure
Tags
since
13.0.0

registerCalendar()

Registers a calendar

public registerCalendar(ICalendar $calendar) : void

use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider

Parameters
$calendar : ICalendar
Tags
since
13.0.0

This function is used to search and find objects within the user's calendars.

public search(string $pattern[, array<string|int, mixed> $searchProperties = [] ][, array<string|int, mixed> $options = [] ][, int|null $limit = null ][, int|null $offset = null ]) : array<string|int, mixed>

use \OCP\Calendar\IManager::searchForPrincipal

In case $pattern is empty all events/journals/todos will be returned.

Parameters
$pattern : string

which should match within the $searchProperties

$searchProperties : array<string|int, mixed> = []

defines the properties within the query pattern should match

$options : array<string|int, mixed> = []
  • optional parameters: ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
$limit : int|null = null
  • limit number of search results
$offset : int|null = null
  • offset for paging of search results
Tags
since
13.0.0
Return values
array<string|int, mixed>

an array of events/journals/todos which are arrays of arrays of key-value-pairs

searchForPrincipal()

Query a principals calendar(s)

public searchForPrincipal(ICalendarQuery $query) : array<string|int, array<string|int, mixed>>
Parameters
$query : ICalendarQuery
Tags
since
23.0.0
Return values
array<string|int, array<string|int, mixed>>

unregisterCalendar()

Unregisters a calendar

public unregisterCalendar(ICalendar $calendar) : void
Parameters
$calendar : ICalendar
Tags
since
13.0.0

        
On this page

Search results