我正在尝试创建一个直接进入用户日历的 Outlook 约会,并将回复发送到不同的电子邮件地址。
这可以使用和LDAP
查询吗?如果没有,我最好的选择是什么?
谢谢Sp
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
据我所知,您无法使用 LDAP 执行此操作。您可能想要掌握 Exchange Web 服务程序集 (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();