Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Super Contributor
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido

Cannot retrieve events from calendar.

I am trying to retrieve a list of events from the device calendar so that I can delete events with specific GUIDs. Why doesn't the following code return anything?

 

bb:Smiley Tongueim::calendar::EventSearchParameters params;
bb:Smiley Tongueim::calendar::CalendarService calendarService;

QList<bb:Smiley Tongueim::calendar::FolderKey> folderIDs;

QList<bb:Smiley Tongueim::calendar::CalendarFolder> folders = calendarService.folders();

foreach(bb:Smiley Tongueim::calendar::CalendarFolder folder, folders)
{

     bb:Smiley Tongueim::calendar::FolderKey folderKey;
     folderKey.setFolderId(folder.id());

      folderIDs.push_back(folderKey);
}

params.setFolders(folderIDs);

QList<bb:Smiley Tongueim::calendar::CalendarEvent> evs = calendarService.events(params);

qDebug() << "COUNT" << evs.count();

foreach(bb:Smiley Tongueim::calendar::CalendarEvent event, evs)
{
     qDebug() << "EVENT" << event.body();
}

 

I'm basically trying to get every single event in the calendar (I created about 5 or 6 to test this code) but it always comes back with a count of 0. What am I doing wrong?