Here is another one.
Export Appointments and Tasks from Outlook (e.g. for use in my personal
wiki):
----
import org.codehaus.groovy.scriptom.ActiveXProxy
outlook = new ActiveXProxy("Outlook.Application")
namespace = outlook.getNamespace('MAPI')
CALENDAR_FOLDER = 9
TASK_FOLDER = 13
def printApps () {
appointments = namespace.getDefaultFolder(CALENDAR_FOLDER)
attributes = 'start end duration subject location alldayevent organizer
importance sensitivity body'.split('\\s')
count = appointments.Items.count.value
for (i in 1..count) {
appointment = appointments.Items.item(i)
attributes.each {|detail| println detail +"\t:\t"+
appointment[detail].value }
println '---'
}
}
def printTasks () {
tasks = namespace.getDefaultFolder(TASK_FOLDER )
atts ='body importance lastmodificationtime mileage noaging saved
sensitivity size subject unread actualwork complete contactnames
datecompleted delegationstate delegator duedate isrecurring ordinal owner
ownership percentcomplete recipients remindertime reminderoverridedefault
responsestate role startdate status statusoncompletionrecipients
statusupdaterecipients teamtask totalwork getrecurrencepattern
statusreport'.split('\\s')
count = tasks.Items.count.value
for (i in 1..count) {
task = tasks.Items.item(i)
atts.each {|detail| println detail +"\t:\t"+ task[detail].value }
}
}
printApps()
printTasks()
----
I'm afraid the code could be more "groovy"-style.
Should we call a contest of the grooviest examples?
cheers
Mittie
-----Original Message-----
From: Guillaume Laforge [mailto:glaf...@codehaus.org]
Sent: Montag, 3. Januar 2005 16:16
To: de...@groovy.codehaus.org
Subject: Re: [groovy-dev] [ANN] Scriptom: COM Scripting in Groovy
Hello Dierk,
Hey, that's a pretty nice example :-)
If we have more and more intersting samples, we should even start a
dedicated page of samples on Confluence!
This example is particularly interesting for doing some automated monkey
testing with Groovy :-)