我们如何以编程方式在服务器端为多个用户添加Outlook事件?
问题描述:
我们必须为程序控制下的几个用户 (每个用户的不同约会事件)添加和更新Outlook日历事件(VB或 Ruby)。个别用户无需采取任何操作的服务器解决方案首选为 。简单的基于ICAL的技术看起来不易于支持更新现有事件(即时间表更改) 。我们如何以编程方式在服务器端为多个用户添加Outlook事件?
任何指针(片断,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
答
Outlook,Exchange和WebDav。
- 如何通过使用WebDAV在Visual C#
- 如何与项目在Exchange 2000 通过使用WebDAV在Visual Basic工作 .NET
由于创建一个Outlook日历 文件夹...第二项是有帮助的。 WebDav方法的问题是身份验证...每个用户的用户名/密码维护都是一个问题。是否可以使用其他API /方法,以便受信任的服务器管理员可以将事件弹出到特定用户的Outlook日历中? – DMisener 2009-09-10 16:37:33
是的。我们使用ActiveDirectory(LDAP),但我的一些概念证明使用了开发管理员。我很抱歉,我刚刚在几周前删除了源代码,因为我不再在公司工作。 – AMissico 2009-09-10 17:41:25