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
Highlighted
New Developer
Posts: 8
Registered: ‎12-31-2013
My Device: Bold 9900
My Carrier: Tigo

parse ICalendar File

Hi!

 

I'm writting an APP that subscribes to a calendar(iCal).

 

bb::pim::calendar::CalendarService m_calendarService;
bb::pim::calendar::ICalendarObjects m_calendarObjects;

m_calendarObjects = m_calendarService.parseICalendarFile(1, 1, "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics", "application/ics");

qDebug("Is Valid: " + m_calendarObjects.isValid());

 I've tried with other calendar files online(i.e http://www.fcbarcelona.com/football/first-team/i-calendar/2013-2014 ) and tried with the 2 mime types availables("text/calendar" and "application/ics". I have this in my .pro file: LIBS += -lbbpim

 

I have also calendar selelected (access_pimdomain_calendars) in my bar-descriptor.xml

 

Could someone help me?

 

Regards

Developer
Posts: 222
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB/C, Z10
My Carrier: Sonera, Saunalahti

Re: parse ICalendar File

parseICalendarFile() parses local files, not external URLs. You need to download the file first.


Kaj-Michael Lang, Home.
Author of: Onki and RetroPlayer
New Developer
Posts: 8
Registered: ‎12-31-2013
My Device: Bold 9900
My Carrier: Tigo

Re: parse ICalendar File

Thanks for your answer. I was trying with a local file in the assets folder. I'm trying several ways but wtih no success.

 

    bb::pim::calendar::CalendarService m_calendarService;
    bb::pim::calendar::ICalendarObjects m_calendarObjects;

m_calendarObjects = m_calendarService.parseICalendarFile(1, 1, "file://" + QDir::currentPath() + "/app/native/assets/soccer.ics", "application/ics");
m_calendarObjects = m_calendarService.parseICalendarFile(1, 1, QDir::currentPath() + "/app/native/assets/soccer.ics", "application/ics");

 I'm also trying with "text/calendar" mime type.

 

I'm also appending file:// to the path of the ics file

 

"file://" + QDir::currentPath() + "/app/native/assets/soccer.ics"

 

Any pointers would be very great.

 

Thank you !

 

 

New Developer
Posts: 8
Registered: ‎12-31-2013
My Device: Bold 9900
My Carrier: Tigo

Re: parse ICalendar File(with console output)

Hi!

 

I'm still trying to get the function to work. I've managed to read the files using

QDir::currentPath() + "/app/native/assets/soccer.ics"

 open them and read it's contents.

 

I've also create an account using my gmail email and use the accountId of the calendar and the messageId of the mail account.

 

the call to parseICalendarFile is as follows

 

m_calendarObjects = m_calendarService.parseICalendarFile(1388763841, 1388763852, QDir::currentPath() + "/app/native/assets/soccer.ics", "application/ics");

 

And the console output is this one

 

pimlib cal 2013-08-23/1 "parseICalendarFile requestData {"cal_account_id":1388763841,"filepath":"/accounts/1000/appdata/com.example.MultiUseP.testDev_e_MultiUseP643f5db1/app/native/assets/soccer.ics","mail_account_id":1388763852,"mimetype":"application/ics"}" 
POST   0x1   
URL Buffer: http://127.0.0.1:8888/calendars/ics/parse 
Curl Easy perform 
Curl Easy GetInfo response code 
Curl easy getInfo content_length_download 
Curl Error Code 0 
Response Code 500 
Status Code 500 
Exception String "" 
pimlib cal 2013-08-23/1 "CalendarService::parseICalendarFile - response code 500" 

 Maybe I'm missing something trivial ...

 

Regards,

 

P.S.

 

The code is here:

 

bb::pim::calendar::CalendarService m_calendarService;
bb::pim::calendar::ICalendarObjects m_calendarObjects;

m_calendarObjects = m_calendarService.parseICalendarFile(1388763841, 1388763852, QDir::currentPath() + "/app/native/assets/soccer.ics", "application/ics");

 

Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: parse ICalendar File(with console output)

The problem is the contact service doesn't have permission to access your app's private sandbox. As a workaround, you will need to write it out to somewhere in the shared file system and use that path.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker