You Are Here:

Community: Wiki

This page was last modified 19:44, 13 October 2008.

CS001028 - Calendar Exporter API

From Forum Nokia Wiki



ID CS001028 Creation date June 13, 2008
Platform S60 3rd Edition, FP2 Tested on devices
Category Symbian C++ Subcategory Calendar


Keywords (APIs, classes, methods, functions): Calendar Exporter API


Note!
This API is not part of the public SDK. It can be found in the SDK API Plug-in.


Purpose

The Calendar Exporter API provides functions to export agenda entries to vCalendar data.

Header files

#include <calsession.h>
 #include <calprogresscallback.h>
 #include <calentryview.h>
 #include <calenexporter.h>
 #include <caliterator.h>
 #include <f32file.h>
 #include <S32FILE.H>
 #include <agnexportobserver.h>

Libraries used

efsrv.lib calinterimapi.lib calenimp.lib estor.lib

Code example

The CCalSession is the interface to the Calendar file. The instantiation of CCalSession will result in a connection to the Calendar Server.

void CCalendarEventsEngine::ConstructL()
    {
    iCalSession = CCalSession::NewL();
    //Open the default calendar file
    iCalSession->OpenL(iCalSession->DefaultFileNameL());
    iWaiter =new (ELeave) CActiveSchedulerWait;
    // calender exporter
    iExporter=CCalenExporter::NewL(*iCalSession);	     
    }

Virtual functions

// Called during calendar entry view creation
 void CCalendarEventsEngine::Progress(TInt aProgress)
    {    
    }
 
 // Called on completion of calendar entry view creation
 void CCalendarEventsEngine::Completed(TInt aError)
    {
    iWaiter->AsyncStop();
    }
 
 // Returns whether or not progress notification is required
 TBool CCalendarEventsEngine::NotifyProgress()
    {
    // Progress notification is required
    return ETrue;
    }

The following code exports calender entries to a file:

void CCalendarEventsEngine::ExportEntriesL()
    {    
    if(iWaiter->IsStarted())
    	{
    	iWaiter->AsyncStop();	
    	}
    // view class for accessing calendar entries
    iCalEntryView = CCalEntryView::NewL(*iCalSession,*this);
    iWaiter->Start();
    // An iterator for iterating though all the entries in the calendar store
    CCalIter* calIter = CCalIter::NewL(*iCalSession);
    TBuf8<150> iterUID;
    // An array of calender entries
    RPointerArray<CCalEntry> calEntryArray;
    iterUID = calIter->FirstL();
    // calender entries file 
    _LIT(KFile,"C:\\CalEntriesFile.txt");
    User::LeaveIfError(iFs.Connect());
    TInt err =  iRWriteStream.Open(iFs,KFile,EFileWrite);
    if(err !=KErrNone)
        {
        User::LeaveIfError(iRWriteStream.Create(iFs, KFile, EFileWrite));
        }
    while (iterUID != KNullDesC8)
        {
        // get entries associated with this UID
        iCalEntryView->FetchL(iterUID, calEntryArray);
        for (TInt k=0; k<calEntryArray.Count();k++)
            {
            // get information from this entry
            CCalEntry* calEntry = calEntryArray[k];
            // export calender entry
            iExporter->ExportVCalL(*calEntry,iRWriteStream);
            }
        iterUID = calIter->NextL();
        };
    calEntryArray.ResetAndDestroy();     
    delete calIter;
    delete iCalEntryView;   
    iRWriteStream.Close();
    iFs.Close();
    }

Sample application

The following sample application is tested in the S60 3rd Edition, FP2 emulator. Image:CalenderImpportExport.zip

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fMMPE5ffileX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxMMPE20fileE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxfileX qfnZuserE5ftagQSxlibpathX qfnZuserE5ftagQSxmmpX qfnZuserE5ftagQSxresourceX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx5E2E0000X