Thunderbird:Extension Snippets

From MozillaWiki
Jump to: navigation, search

This page is for javascript code snippets of things I've figured out how to do in Thunderbird. It is posted to the mozilla wiki in the hopes of being useful to others.

Create a Todo

(Note:this snippet requires the lightning extension to work)

The following snippet is how you create a new todo item and add it to the the first calendar on your list. You could instead smartly iterate over the cals to get the right one that you wanted.

var todo = Components.classes[";1"].
var date = Components.classes[";1"].
date.icalString = "20080907T120000Z";

todo.title = "Crazy new todo";
todo.dueDate = date;

var calManager = Components.classes[";1"].

var cals = calManager.getCalendars({});
var cal = cals[0]; // gets the first callendar

cal.addItem(todo, null);