And the error you get is? It should be very simple to get entries using calinterim api. The new CCalEntryView class has the FetchL method (or better said 2 overloaded method) used to fetch entries. You should provide a uid to this method.....those uid you can get using GetIdsModifiedSinceDateL (here you can use min date to get all your ids).
Got your error. You're working with CCalInstanceView but you should work with CCalEntryView...and in CCalEntryView there should be GetIdsModifiedSinceDateL method, rigth ? The diference between an entry and an instance exists also in pre 9.1 version rigth? An entry is a calendar event of some sort (can be simple or repeating). An instance is a single occurence of a repeating entry.
Also i don't understand your problem with the session. What error do you get there?
Quote from: lkz633
Hi,
now the session does not even start correctly, here is the code:
I want to get all instances/occurences, not just an entry, so I am using CCalInstanceView
I do not get an error, but the SDK says:
static IMPORT_C CCalInstanceView *NewL(CCalSession &aSession, MCalProgressCallBack &aProgressCallBack); The instance view can not be used until the Completed() function is called on the progress callback with the value KErrNone.
Ok...i understood what you mean....you should start the activescheduler to get the callback Your code will be:
Code:
  iSession = CCalSession::NewL();   CleanupStack::PushL(iSession);   iSession->OpenL(iSession->DefaultFileNameL());   iView = CCalInstanceView::NewL(*iSession,*this);   ActiveScheduler::Start();
I know this is far from obviuos from SDK.
And the rest of the code should be ok....it should work. If not try to see if with CalCommon::EIncludeAll you get something or not
pirosl, could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK. If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid? Thank you.
pirosl, could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK. If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid? Thank you.
You can't get in a single shot all entries. The valid uids you will get it using GetIdsModifiedSinceDateL method as i mentioned in an earlier porst
I add to my console app ONLY one string: CCalSession* iSession = CCalSession::NewL(); and after that app failed with leave code -1 (object not found). If I comment this one, app works without any problems. What problem can be here? Should I do smth except of adding of lib and header files for this class? Thank you in advance, Julia
if i create even simplest console application (using wizard), add library calinterimapi.lib, CAPABILITY and include <calsession.h> it works correctly on emulator and prints "hello, world!", but when I add ONLY one string CCalSession* iSession = CCalSession::NewL(); it failed with output: "failed, leave code -1".
There shouldn't be anything wrong with CCalSession::NewL();.....i suppose you are not making any debug there....you only see that your app crashes rigth? If so....have you delete the session? May be the error you mention is in other place
The calendar engine loads some other component (I forget which from memory, the alarm server or something like that) which isn't present and running in a text shell environment - which is probably what is happening if you are running a simple console application as opposed to a full UI application. So when you try to create a session to the calendar it in turn trys to connect to the missing server and you get -1 as it can't be found.
Try running your application in the full emulator environment and not the text emulator environment.
(Make sure in epoc32/data/epoc.ini there isn't the line startupmode 1)
Forum posts: 982
It should be very simple to get entries using calinterim api. The new CCalEntryView class has the FetchL method (or better said 2 overloaded method) used to fetch entries. You should provide a uid to this method.....those uid you can get using GetIdsModifiedSinceDateL (here you can use min date to get all your ids).
pirosl
Forum posts: 39
Forum posts: 47
now the session does not even start correctly, here is the code:
iSession = CCalSession::NewL();
CleanupStack::PushL(iSession);
iSession->OpenL(iSession->DefaultFileNameL());
iView = CCalInstanceView::NewL(*iSession,*this);
The Completed method of the observer is never called.
After this to get all instances, I would then try with this code:
TTime Start;
Start.HomeTime();
TTime End(_L("20080000:"));
TCalTime iStart;
iStart.SetTimeLocalL(Start);
TCalTime iEnd;
iEnd.SetTimeLocalL(End);
CalCommon::TCalTimeRange iRange(iStart,iEnd);
RPointerArray<CCalInstance> iInstances;
iView->FindInstanceL(iInstances, CalCommon::EThisOnly, iRange);
How to correctly open the session?
Regards
lkz633
Forum posts: 47
This seems to be not in the SDK
Forum posts: 982
The diference between an entry and an instance exists also in pre 9.1 version rigth? An entry is a calendar event of some sort (can be simple or repeating). An instance is a single occurence of a repeating entry.
Also i don't understand your problem with the session. What error do you get there?
now the session does not even start correctly, here is the code:
iSession = CCalSession::NewL();
CleanupStack::PushL(iSession);
iSession->OpenL(iSession->DefaultFileNameL());
iView = CCalInstanceView::NewL(*iSession,*this);
The Completed method of the observer is never called.
After this to get all instances, I would then try with this code:
        TTime Start;
Start.HomeTime();
TTime End(_L("20080000:"));
TCalTime iStart;
iStart.SetTimeLocalL(Start);
TCalTime iEnd;
iEnd.SetTimeLocalL(End);
CalCommon::TCalTimeRange iRange(iStart,iEnd);
RPointerArray<CCalInstance> iInstances;
iView->FindInstanceL(iInstances, CalCommon::EThisOnly, iRange);
How to correctly open the session?
Regards
lkz633
pirosl
Forum posts: 47
I want to get all instances/occurences, not just an entry, so I am using CCalInstanceView
I do not get an error, but the SDK says:
static IMPORT_C CCalInstanceView *NewL(CCalSession &aSession, MCalProgressCallBack &aProgressCallBack);
The instance view can not be used until the Completed() function is called on the progress callback with the value KErrNone.
But this completed() function is never called
lkz633
Forum posts: 982
Your code will be:
  CleanupStack::PushL(iSession);
  iSession->OpenL(iSession->DefaultFileNameL());
  iView = CCalInstanceView::NewL(*iSession,*this);
  ActiveScheduler::Start();
I know this is far from obviuos from SDK.
And the rest of the code should be ok....it should work.
If not try to see if with CalCommon::EIncludeAll you get something or not
pirosl
Forum posts: 1
could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK.
If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid?
Thank you.
Forum posts: 47
Thanks a lot for your help Lucian, that solved it
The SDK should be really updated at this point.
Regards
lkz633
Forum posts: 982
could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK.
If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid?
Thank you.
You can't get in a single shot all entries. The valid uids you will get it using GetIdsModifiedSinceDateL method as i mentioned in an earlier porst
pirosl
Forum posts: 39
CCalSession* iSession = CCalSession::NewL();
and after that app failed with leave code -1 (object not found).
If I comment this one, app works without any problems.
What problem can be here? Should I do smth except of adding of lib and header files for this class?
Thank you in advance,
Julia
Forum posts: 982
pirosl
Forum posts: 39
but when I add ONLY one string CCalSession* iSession = CCalSession::NewL();
it failed with output: "failed, leave code -1".
Forum posts: 982
pirosl
Forum posts: 364
Try running your application in the full emulator environment and not the text emulator environment.
(Make sure in epoc32/data/epoc.ini there isn't the line startupmode 1)