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?
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.
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("username@domain.com");
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;