removeEvent(event, options)

Removes an event from a device’s calendar.

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.

Note

Syntax 

1import { getCalendarService } from 'lightning/mobileCapabilities';
2removeEvent(event: Event,
3  options: CalendarServiceOptions
4  ): Promise<Object>

Parameters 

  • event—(Required) The Event object to be removed from the device’s calendar.
  • options—(Required) A CalendarServiceOptions object 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.

1myCalendarService
2  .removeEvent(event, options)
3  .then((results) => {
4    console.log("Event successfully removed!");
5  })
6  .catch((error) => {
7    console.error("Error code: " + error.code);
8    +console.error("Error message: " + error.message);
9  });

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.