プログラム制御 (VB または Ruby) の下で、複数のユーザーの Outlook カレンダー イベント (ユーザーごとに異なる予定イベント) を追加および更新する必要があります。個々のユーザーがアクションを必要としないサーバー ソリューションが推奨されます。単純な ICAL ベースのテクノロジは、既存のイベントの更新 (スケジュールの変更など) を簡単にサポートしているようには見えません。
任意のポインター (スニペット、API ドキュメントをいただければ幸いです)
ところで:各ユーザーが次のようなスクリプトを実行する必要がある非サーバーベースのソリューションは、現在持っているものです。
# Loosely based on http://snippets.dzone.com/posts/show/4301
require 'delegate_to'
require 'win32ole'
# Simple DSL wrapper out Outlook API
class OutlookCalendar < Array
CALENDAR_FOLDER=9
OUTLOOK=WIN32OLE.new 'Outlook.Application'
class Event
def initialize &block
@_=OutlookCalendar::OUTLOOK.CreateItem 1
instance_eval(&block) if block_given?
end
def subject *arg
@_.subject=arg.first unless arg.empty?
@_.Subject
end
def start *arg
@_.Start=arg.first unless arg.empty?
@_.Start
end
def duration *arg
@_.Duration=arg.first unless arg.empty?
@_.Duration
end
def body *arg
@_.Body=arg.first unless arg.empty?
@_.Body
end
def location *arg
@_.Location=arg.first unless arg.empty?
@_.location
end
def reminder *arg
@_.ReminderMinutesBeforeStart=arg.first unless arg.empty?
@_.ReminderSet=true
@_.ReminderMinutesBeforeStart
end
delegate_to :_
end
def initialize
super
refresh
each{|_| yield _} if block_given?
end
def refresh
mapi=OutlookCalendar::OUTLOOK.GetNameSpace 'MAPI'
@calendar=mapi.GetDefaultFolder CALENDAR_FOLDER
entries=[] # [ Subject Location Start End Body ]
@calendar.Items.each{|_| entries << _} # can't use collect
self.replace entries.sort_by{|_| _.Start}
self
end
def << event
event.save
end
end
# Sample Usage:
if $0==__FILE__
class OutlookCalendar
def show
each{|_| puts '%s - %s : %s' % [ _.Start,_.End,_.Subject ]}
end
end
Calendar=OutlookCalendar.new
# Show original events
Calendar.show
# Delete possible previous events
Calendar.each{|_| _.Delete if /^S3W:/.match _.Subject}
# Add updated event
Calendar << OutlookCalendar::Event.new do
start '7/29/2007 11:00 AM'
duration 300
subject 'S3W: Hall of Fame Induction'
body 'Tony Gwynn and Cal Ripken Jr.'
location 'Cooperstown, NY'
reminder 15
end
# Show updated list of events
puts '-'*50
Calendar.refresh.show
end