×
Namespaces

Variants
Actions

Archived:Exporting calendar entries to a text file in Flash Lite

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

This code snippet demonstrates how to use the Calendar Service API in a Flash Lite 3.0 application to export calendar entries from the default calendar of the device to an external text file (supported from S60 5th Edition onwards).

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Article
Keywords: Service.Calendar, calendar.Export()
Created: User:Nokia Developer KB (15 Dec 2008)
Last edited: hamishwillee (14 May 2013)

Contents

Preconditions

The test device needs to have at least one calendar entry in the calendar.

Source

// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "Export Calendar entries";
 
// Create a new Service object which has Calendar data
var calendar = new Service("Service.Calendar", "IDataSource");
 
// Get calendar entries from the default calendar application
// Define input parameters for the List of calendar entries
var inListParams = {Type:"CalendarEntry"};
 
// Define the result value for the List
var outListParams = calendar.GetList(inListParams);
var outList = outListParams.ReturnValue;
var outputListEntry = null;
var idList:Array = new Array();
text_txt.text += "Exported entries: \r";
// Go through all calendar events and push them to the array
do {
outputListEntry = outList.next();
if (null != outputListEntry) {
idList.push(outputListEntry.id);
text_txt.text += "-"+outputListEntry.id+"\r";
} else {
break;
}
} while (true);
 
// Define the input data for the exported text file
var inputData = {IdList:idList, Format:"VCal",
FileName:"c:\\Data\\Others\\example.txt"};
 
// Define the input parameters for export
var inParams = {Type:"CalendarEntry", Data:inputData};
 
// Define the result value
var outParams = calendar.Export(inParams);
if (outParams.ErrorCode == 0) {
text_txt.text += "Export success!";
} else {
var errorId = outParams.ErrorCode;
text_txt.text += "\rError: "+errorId;
}

Postconditions

One exported entry is saved as example.txt in the C:\Data\Others directory. The IDs of all the exported calendar entries are displayed in the application.

Example application

The following sample application has been tested in Nokia 5800 XpressMusic (S60 5th edition, Flash Lite 3.0). File:FlashLite Export Calendar Entries.zip

See also

This page was last modified on 14 May 2013, at 06:16.
40 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×