使用 EWS 托管 API 为其他用户创建约会?
在 EWS 托管 API 中,可以轻松地为特定用户创建约会:
ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredentials ( "administrator", "password", "domain" );
service.AutodiscoverUrl(emailAddress);
Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();
这将为管理员创建约会。但是假设我实际上想为另一个用户创建一个约会(而不是将该用户添加为我的约会的与会者)。这可以通过 EWS 托管 API 实现吗?
In EWS Managed API is it easy to create an appointment for a specific user:
ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredentials ( "administrator", "password", "domain" );
service.AutodiscoverUrl(emailAddress);
Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();
This will create a appointment for the administrator. But say I wanted to actually create an appointment for another user (not add that user as an attendee to me appointment). It this possible via the EWS Managed API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也会工作。
然后将 inboxFolder.id 传递给 Appointment.Save 调用。更新和删除不需要这个。
最好的答案是使用模拟,但这需要服务器管理员启用它。如果你没有这样的权力,这个方法可以让你做你需要做的事。
注意:运行应用程序的用户必须拥有目标帐户的权限,否则将会失败(理应如此)。
此处找到:http://msdn.microsoft.com/en-us/库/gg274408(v=EXCHG.80).aspx
Will work too.
Then pass inboxFolder.id to the Appointment.Save call. The updates and deletes don't need this.
The best answer is to use impersonate, but this requires it to be enabled by the server admins. If you don't wield such power, this method will let you do what you need.
Note: the user running your application must have permissions on the target account or this will fail (as it should).
Found here: http://msdn.microsoft.com/en-us/library/gg274408(v=EXCHG.80).aspx
我知道这个问题已经得到解答,但为了回答@Aamir 的评论,您可以使用代表来完成此操作,我刚刚为我正在从事的项目完成了此操作。
正如 @matt 在他的回答中建议的那样,您可以修改约会的保存方法以指向其他用户文件夹,在本例中为日历。
代码如下所示
希望有帮助
I know this has been answered but in answer to @Aamir's comment you can do this using delegates I've just done it for a project I'm working on.
As @matt suggested in his answer you can amend the save method of the appointment to point to the other users folder which in this case would be Calendar.
Code would look as below
Hope that helps
我从这篇文章中弄清楚了:
http://msdn.microsoft.com/en-us/ library/dd633680(EXCHG.80).aspx
您应该使用
service.ImpersonatedUserId
属性。I figured it out from this article:
http://msdn.microsoft.com/en-us/library/dd633680(EXCHG.80).aspx
You should use the
service.ImpersonatedUserId
attribute.