Envelope: Exchange 2010 for ColdFusion 8 and 9

Today I'm thrilled to share a new open source project; not directly from myself, but from my (soon to be former) employer, Wharton. I did write pretty much all of the code, but it was on their time and it is with their gracious permission that I've been allowed to share it.

Like many other organizations, I'm sure, we were sorely affected by the loss of CFExchange functionality when Exchange 2010 was released. It was not long after ColdFusion 9 was released, and CFExchange only supported up to Exchange 2007. As such a large organization, with no clear indication or timeline on the release of a compatability patch or a new version of ColdFusion that would support Exchange 2010, we had no choice but to roll our own solution. Delaying the Exchange upgrade indefinitely for web integration just didn't make any business sense.

At first we tried interacting directly between ColdFusion and EWS, the Exchange Web Services API, new in Exchange 2010. This turned out to be a complete waste of time. As far as I can tell, EWS is not any "normal" form of SOAP, and it's definitely not REST. Spending a week trying to figure this out made me want a lobotomy. So we went another route.

In the past I had had some --albeit, minimal-- experience creating SOAP web services in .NET, and Microsoft provides a library for interacting with EWS for .NET, so the new approach was to write a SOAP web service that interacts with EWS. And to make it easier for my peers to use, I also wrote a ColdFusion CFC that abstracted access of that SOAP api into a few method calls. The result is Envelope.

Is it elegant? No. Is it ideal? Nope. Would I call it fast? Not really. Is it anything approaching great .NET code? Not even a snowball's chance in hell.

But it works.

And something that works --even if sometimes slow-- is clearly better than nothing.

It also doesn't cover everything you could ever want to do with Exchange. We only implemented the functionality that we needed; but the template is there and it would be easy enough for you to add whatever functionality is missing, if you have some basic C# and ColdFusion knowledge. Functionality included is:

  • Create an email
  • Get unread count
  • Get email messages
  • Create calendar item (meeting if invitees included, appointment otherwise)
  • Get calendar item by id
  • Get calendar items by date range (basic)
  • Get calendar items by date range (detailed; slower)
  • Update calendar item
  • Create contact
  • Update contact
  • Delete contact
  • Get contacts
  • Create task
  • Get tasks

It's completely free, but of course it comes with the caveat that security is entirely up to you. It requires the use of Exchange Impersonation accounts, which have the power to impersonate any other Exchange acccount. In my case, that meant that in the wrong hands, someone could be sending fraudulent emails "from" the dean of the Wharton school, or deleting meetings, and so on. Definitely a delicate security situation, so don't take it lightly. You should guard your API Keys with more or less your highest clearance level, and be sure that any application using Envelope is well secured, too.

In the ReadMe file, I try to cover all of the bits that require customization for your environment, but if you have issues you can Contact Me or file a bug against the github project.

Download it!

You can get Envelope here: http://www.github.com/wharton/Envelope.

in Exchange | My projects | Open Source | No Responses Yet Posted 2012-03-01 07:54

Help Adobe Understand the CF Community

The ColdFusion team has a very, very short (2 questions!) survey, to help them understand the tools that the CF Community prefers. It will only take a few seconds of your time, so please take the survey now!

in Adobe | ColdFusion | No Responses Yet Posted 2012-02-22 07:57

CF10 REST Bug with Block Comments

I spent some time over the weekend working on a project using the new REST functionality in the ColdFusion 10 Public Beta, and I ended up discovering a bug.

I have become a hard and fast fan of script-only CFC's, so I was writing my REST API using them. Something went wrong somewhere, and I decided to comment out a method to see if that would fix it, and it did not. Long story short, the comment caused problems of its own!

Consider this code:

component
rest="true"
restpath="hello"
{

    remote struct function hello()
    httpmethod="GET"
    produces="application/json,application/xml"
    {
        return { 'message' = 'hello world' };
    }
/*
    remote struct function echo(string input restargsource="path")
    httpmethod="get"
    restPath="echo/{input}"
    produces="application/json,application/xml"
    {
        return { 'echo333' = input };
    }
*/

}

Seems pretty innocuous, right? Trouble is, having the 2nd method commented out with the block comment that way causes the REST Refresher to fail:

I tried lots of different styles of block comments and here's what I found. These comments work without issue:

/*
*/

and

/*
a
b
c
*/

...but these all cause the failure described above:

/**/

and

/*

*/

and

/* test */

and

/*
 a
 b
 c
*/

Note that this last one is the same as the last one that works, except that each line (a,b,c) has a space before the letter. With the space it fails, without the space, it works.

Lastly, I'll mention that none of these are illegal syntax for CFC's. I tried the CFC Explorer and calling the uncommented method as a SOAP service and both worked fine in each case.

I've filed this as bug #3119366. If you want to see it fixed, please vote for it!

in ColdFusion | Zeus | No Responses Yet Posted 2012-02-21 12:14

ColdFusion 10: The Good Parts

Unless you live under a rock, you've probably already seen the news that Adobe ColdFusion 10 is now in public beta, and you can download it and start playing with it. I know this is old news by now -- nearly 8pm of the day it was released -- but I was tied up in meetings all day and actually hadn't heard the news myself until after dinner.

So instead of posting just another announcement, I thought I would discuss the changes and new features that excite me, a little bit.

Things that suck less

First and foremost, this release relieves many existing pain points with earlier versions of ColdFusion.

  • The Administrator now includes update/hotfix notification and auto-install functionality. Hallelujah!
  • Scheduled tasks now have a much more robust underlying engine (Quartz), capable of task dependencies, resource-based scheduling, and much much more! Can I get an Amen?!
  • <cfinclude/> now has a runOnce attribute, which will make it analogous to PHP's "require_once", if you're familiar with that.
  • the group attribute from the <cfoutput> tag has been added to the <cfloop> tag.
  • Exchange integration is BACK!

The New Hotness

  • Closures have been added. I'm one of the people that don't really grok it yet, at least from a ColdFusion context, but I do believe that they will bring a new kind of awesome with them.
  • Axis, the library that enables SOAP in earlier versions of CF, has been updated and the new version brings REST web service creation functionality. I'll surely be covering this in more depth here on my blog, since REST is kind of my pet-feature.
  • Many HTML5 features, like using Canvas for drawing charts, Web Sockets, and more, have had functionality built around them. I see these as similar to the AJAX integration. For people who have been too scared/busy/whatever to learn to do it "the hard way", CF will provide some baseline level of functionality that makes it super easy to implement. Then, once they really understand what it's accomplishing, stronger developers will probably give it up in favor of leaner libraries or tools that give them more flexibility and control. But it should prove to be a great on-ramp, and I expect that we'll see it help many developers and web businesses get up to speed.

Of course there's much more in both categories... these are just a few things that spring immediately to my mind.

So head on over to Adobe Labs and grab it for yourself!

in ColdFusion | 3 Responses Posted 2012-02-17 07:38

I'm going to look a bit different the next time you see me

For the last 16 months I have refused to get a haircut. At first I just wanted to grow my hair long to have long hair. After a while I decided I was done with the look, but that to just cut it off and sweep it into the trash would be a waste. So I decided to wait as long as it would take to be able to donate it to Locks of Love. And my friends, that day has arrived!

Before:

Locks of Love: Before

After:

Locks of Love: After

... So if you want to know which dude to look for at cf.Objective in May... he looks something like this one (above).

During!

I also had the stylist take a few pictures during the process, and because I have no shame, here you go...

Locks of Love: During!

If you ever get the opportunity, I think you should donate hair to Locks of Love. Not only is it a wonderful cause to donate to, but it saves you money from all of the time you're not getting your hair cut. I'm so happy that I was able to make this donation. :)

in Off Topic | 2 Responses Posted 2012-01-30 08:46