
Writing code to add an event to the RIM calendar as the sample below will not actually save it or appear in the calendar of the device if you escape out of the form after you run the function. It will only save it if you use MainForm.Display() to navigate to the application initial form after running the function.
Does anybody know why? Is there another way to commit the Event Task or Contact without navigating to a different form or Ending the application?
BTW, that’s how it works on the simulator, didn’t try it on the actual device yet.
var evt = Event.create();
evt.start = start;
evt.end = end;
evt.summary = summary;
evt.location = "Office";
var alm = new Date(start);
alm.setMinutes(alm.getMinutes() - 60, 0, 0);
evt.alarm = alm;
If you're looking for something BlackBerry specific, use EventList and Event found in the
net.rim.blackberry.api.pimnamespace. It should save the event into the Calendar with no problems.----------------------------
EventList _evL = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST,PIM.READ_WRITE);Event evt = _evL.createEvent();
...
----------------------------
Note: If you are developing strictly for the BlackBerry, I believe you can also use a
BlackBerryEventobject instead of anEventobject.You may have to call the
evt.commit()method to save the calendar entry... I'm not entirely sure.thank you for your responce.
but the "Visual Studio Plugin" dosen't have all these classes available, only the built ins.
Sorry... didn't realize this was in the Visual Studio Plugin section.
Have you allowed your application to access PIM data through the Application Permissions on the handheld? If you're testing on a real device (as opposed to the simulator), you may need to allow this on the BES server as well through an IT policy.