Removes an event from a device’s calendar.
note: Using removeEvent() is an inherently dangerous action, as it allows event data to be irreversibly deleted. Use caution when using this functionality in your component. At an absolute minimum, consider adding a confirmation window for your users that clearly states the outcome of the action, with an option for them to cancel if they wish.
Syntax
import { getCalendarService } from 'lightning/mobileCapabilities';
removeEvent(event: Event,
options: CalendarServiceOptions
): Promise<Object>
Parameters
event—(Required) TheEventobject to be removed from the device’s calendar.options—(Required) ACalendarServiceOptionsobject to configure the CalendarService request.
Returns
If successful, nothing is returned. If unsuccessful, an error message is returned.
Usage
Use this function to remove an event from a device’s calendar.
myCalendarService
.removeEvent(event, options)
.then((results) => {
console.log("Event successfully removed!");
})
.catch((error) => {
console.error("Error code: " + error.code);
+console.error("Error message: " + error.message);
});