将 ASP.NET Intranet 应用程序与 Outlook 日历集成的技术

发布于 2024-10-05 15:44:16 字数 657 浏览 0 评论 0 原文

我不能再忽视用户的叫喊声了。他们想要一个任务调度系统,而在某些时候我必须交付。我正在考虑制作自己的系统(并不难),但是用户将拥有两个并行的任务管理系统,因为他们已经使用 Outlook 来完成相同的事情。

在 Outlook 日历/任务集成方面,我想到了两种可能的方法:

1) 使用 JavaScript 和自动化

我似乎记得可以在 JavaScript 中实现自动化。

优点:

  • 我以前做过自动化。

缺点:

  • 自动化太可怕了!
  • 一些坚持(展望 实体)的责任是 客户端代码,其余的 服务器端的责任 代码。这感觉太可怕了。
  • 可能的安全问题/
    IT部门的封锁

2) 使用一些 .NET API 直接与 Exchange Server 交互

Intranet 使用单点登录,因此希望这可以使安全问题变得更容易。

优点:

  • 所有持久性代码都是 服务器端。

缺点:

  • 我什至不知道这样的API 存在。

一如既往,我喜欢站在巨人的肩膀上。曾经走过这条路的人可以给我一些指导吗?

I can ignore the braying of my users no longer. They want a task scheduling system and at some point I have to deliver. I was thinking of making my own (can't be hard), but then users would have two side-by-side task managements systems since they already use Outlook for the same thing.

In terms of Outlook calendar / task integration, two possible approaches occurred to me:

1) Use JavaScript and Automation

I seem to remember it's possible to do automation in JavaScript.

PROS:

  • I've done automation before.

CONS:

  • Automation is horrible!
  • Some persistence (Outlook
    entities) is the responsibility of
    client-side code, and the rest the
    responsibility of server-side
    code. This feels horrible.
  • Possible security concerns /
    blocking from IT dept.

2) Use some .NET API to interact with Exchange Server directly

The intranet uses single-sign on, so hopefully that should make security issues easier.

PROS:

  • All persistence code would be
    server-side.

CONS:

  • I don't even know that such an API
    exists.

As ever, I like to stand on the shoulders of giants. Can anyone who has trodden this path before give me some guidance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

゛时过境迁 2024-10-12 15:44:16

我们最近使用 Exchange Web 服务托管 API。这将是第二种选择的一种方式。我从来没有使用 JavaScript 尝试过同样的事情,所以对此一无所知。

关于评论 1 的查询:您将需要一个 AD 用户,您将使用该用户来模拟其他用户帐户并在其他用户帐户上工作。请参阅下面的示例:

假设我有一个名为 fabrikam\myappname 的 Active Dir 帐户,密码为 Fabi$Gre@t2010

void CreateFolder(string targetUserEmail) {
    string appName = "myappname";
    string appPassword = "Fabi$Gre@t2010";
    string emailDomain = "fabrikam";
    string appEmail = string.Format("{0}@{1}.com", appName, emailDomain);

    ExchangeService service = new ExchangeService();
    service.Credentials = new NetworkCredential(appName, appPassword, emailDomain);
    service.AutodiscoverUrl(appEmail);

    service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, targetUserEmail);

    Folder newFolder = new Folder(service);
    newFolder.DisplayName = "TestFolder1";

    newFolder.Save(WellKnownFolderName.Inbox);
}

请检查文章 配置 Exchange 模拟以使模拟正常工作。

希望有帮助。

We recently did same kind of integration for our intranet application using the Exchange Web Services Managed API. That would be one way of going about for the second option. I have never tried the same using JavaScript, so no idea on that.

With regards to the query for comment 1: You would need a single AD user whom you will be using to impersonate and work on the other users account. Please refer to the example below:

Lets say I have an Active Dir account named fabrikam\myappname with password Fabi$Gre@t2010

void CreateFolder(string targetUserEmail) {
    string appName = "myappname";
    string appPassword = "Fabi$Gre@t2010";
    string emailDomain = "fabrikam";
    string appEmail = string.Format("{0}@{1}.com", appName, emailDomain);

    ExchangeService service = new ExchangeService();
    service.Credentials = new NetworkCredential(appName, appPassword, emailDomain);
    service.AutodiscoverUrl(appEmail);

    service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, targetUserEmail);

    Folder newFolder = new Folder(service);
    newFolder.DisplayName = "TestFolder1";

    newFolder.Save(WellKnownFolderName.Inbox);
}

Do check the article Configuring Exchange Impersonation to make Impersonation working.

Hope that helps.

阳光下的泡沫是彩色的 2024-10-12 15:44:16

如果由于某种原因您不想启用模拟(因为它是全局的),您还可以让每个用户与运行应用程序的您的个人资料共享他们的日历(CodeCanvas 示例中的 appName)。一旦他们给予您适当的权限(读/写/编辑),您就可以将约会添加到他们的日历中,如下所示:

myappointment = new Appointment(service);
myappointment.Subject = "subject";
myappointment.Body = "body";
myappointment.Start = myStartTime;
myappointment.End = myStartTime.AddHours(1);
myMailbox = new Mailbox("[email protected]");
myFolder = new FolderId(WellKnownFolderName.Calendar, myMailbox);
myappointment.Save(myFolder, SendInvitationsMode.SendToNone);
/* get the appointment id so your app can access it later to update or delete */ 
myexchangeid = myappointment.Id.UniqueId;

If for some reason you don't want to enable impersonation (since it's global) you can also have each user share their calendar with your profile that is running the app (appName in CodeCanvas' sample). Once they give your the appropriate permission (read/write/edit) you can add appointments to their calendar like so:

myappointment = new Appointment(service);
myappointment.Subject = "subject";
myappointment.Body = "body";
myappointment.Start = myStartTime;
myappointment.End = myStartTime.AddHours(1);
myMailbox = new Mailbox("[email protected]");
myFolder = new FolderId(WellKnownFolderName.Calendar, myMailbox);
myappointment.Save(myFolder, SendInvitationsMode.SendToNone);
/* get the appointment id so your app can access it later to update or delete */ 
myexchangeid = myappointment.Id.UniqueId;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文