require 'win32ole' outlook = WIN32OLE.new('Outlook.Application') # creating a new task task = outlook.CreateItem(3) task.Subject = 'Order Yankees Playoff Tickets' task.Body = 'Order first-round playoff tickets...' task.ReminderSet = true task.ReminderTime = '07/19/2007 9:00 AM' task.DueDate = '07/20/2007' task.ReminderPlaySound = true task.ReminderSoundFile = 'C:\Windows\Media\Ding.wav' task.Save # getting tasks data mapi = outlook.GetNameSpace('MAPI') tasks = mapi.GetDefaultFolder(13) for task in tasks.Items.Restrict("[Status] = 'Waiting on someone else'") puts task.Subject puts task.DueDate puts task.PercentComplete puts task.Status puts task.Importance puts task.LastModificationTime end # search for and delete tasks for task in tasks.Items.Restrict("[Subject] = 'Order Yankees Playoff Tickets'") task.Delete end
Further details can be found here.