Remove a calendar entry with no notification

You can remove a calendar entry on a BlackBerry® device without sending notifications to the entry's participants.

  1. Import the required classes and interfaces.
    import java.util.*;
    import javax.microedition.pim.*;
    import net.rim.blackberry.api.pdap.BlackBerryEvent;
    import net.rim.blackberry.api.pdap.BlackBerryEventList;
  2. Invoke PIM.openPIMList() to open a list of calendar entries as a BlackBerryEventList object.
    BlackBerryEventList eventList = null;
    try 
    { 
       eventList = (BlackBerryEventList) 
          PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE); 
    }
    catch (PIMException e) 
    {
       // Handle exception
    }
  3. Retrieve a BlackBerryEvent object from the list of entries.
    Enumeration events = eventList.items();
    BlackBerryEvent event = (BlackBerryEvent) events.nextElement();
  4. Invoke BlackBerryEventList.removeElement() and specify the flag BlackBerryEvent.DO_NOT_NOTIFY_ATTENDEES to remove the entry without notification.
    try
    {
       eventList.removeEvent(event, BlackBerryEvent.DO_NOT_NOTIFY_ATTENDEES);
    }
    catch (PIMException e)
    {
       // handle exception
    {

    If an error occurs when you try to remove the event, the method throws a PIMException.

Code sample

BlackBerryEventList eventList = null;
try 
{ 
   eventList = (BlackBerryEventList) 
      PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE); 

   Enumeration events = eventList.items();
   BlackBerryEvent event = (BlackBerryEvent) events.nextElement();

   eventList.removeEvent(event, BlackBerryEvent.DO_NOT_NOTIFY_ATTENDEES);           
}
catch (PIMException e) 
{
   // Handle exception
}
Next topic: Contact list

Was this information helpful? Send us your comments.