2012-06-20 58 views
0

我正在尝试创建一个Outlook预约,直接进入用户日历,并将回复转到其他电子邮件地址。展望预约c#

这是可能使用和LDAP查询吗?如果不是,我最好的选择是什么?

感谢 SP

回答

0
public void addAppointments(String subject,String body,DateTime startTime,DateTime endTime,String location) 
{ 
    Appointment app = new Appointment(_service); 
    app.Subject = subject; 
    app.Body = body; 
    app.Start = startTime; 
    app.End = endTime; 
    app.Location = location; 

    //DayOfTheWeek[] days = new DayOfTheWeek[] { DayOfTheWeek.Saturday }; 
    //app.Recurrence = new Recurrence.WeeklyPattern(app.Start.Date, 1, days); 
    //app.Recurrence.StartDate = app.Start.Date; 
    //app.Recurrence.NumberOfOccurrences = 3; 

    app.Save(); 
} 

这种方法可以用来添加预约。使用Outlook API。

此链接也有帮助。

http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/7ae6d938-a64f-4c27-95ba-435f84da236f

0

据我知道你不能做到这一点使用LDAP。您可能想要掌握Exchange Web Services程序集(Microsoft.Exchange.WebServices),它包装交换服​​务器Web服务API并允许您轻松地“交换”。

例如示例代码来获得任命:

var service = new ExchangeService { UseDefaultCredentials = true }; 
service.AutodiscoverUrl(emailAddress); 

// Set the calendar view to use 
var view = new CalendarView(startDate, endDate); 

// Get the target folder ID using the email address 
var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(emailAddress)); 

// Get the appointments 
var response = service.FindAppointments(folder, view); 

编辑:

并创建一个 - (使用一些上面的代码来获得服务实例):

var apt = new Appointment(service); 
apt.Start = DateTime.Now; 
// Do other stuff 
apt.Save();