我们必须为多个用户添加和更新Outlook日历事件 (程序控制下的每个用户的不同约会事件)(VB或 红宝石)。个人用户无需任何操作的服务器解决方案 首选。简单的基于ICAL的技术似乎不容易支持 更新现有事件(即计划变更)。
任何指针(片段,API文档将不胜感激)
BTW:一种基于非服务器的解决方案,每个用户都必须运行脚本 类似于以下是我们目前拥有的:# 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
答案 0 :(得分:0)
Outlook,Exchange和WebDav。