About the Author

author photo

Adam Trachtenberg is the Director of the LinkedIn Developer Network, where he oversees developer relations and marketing for the LinkedIn Platform. Before LinkedIn, Adam worked at eBay in platform product management and marketing. Even earlier, he co-founded Student.Com and TVGrid.com. Adam is the author of PHP Cookbook and Upgrading to PHP 5. He lives in San Francisco.

See All Posts by This Author

Outlook Calendar REST API

I’ve been thinking about useful, but non-existent, web services lately. What I want is a REST interface to my Outlook calendar (i.e. “the one I’m forced to use at work“) that serves up vCalendar data. (Actually vCalendar isn’t XML, but there looks to be an XML version. I would prefer that, as I could always transform XML to standard vCal using XSLT.) I will then take that data and write a nifty Dashboard widget to display my next appointment on my Macintosh.

I know there must be some way to do this. I’ve seen products that sync calendar data with Outlook, but the files I found on the Microsoft web site weren’t too helpful in getting me started. I couldn’t tell if I need use Windows to communicate with Exchange using some special protocol, or if I can do it from Linux using standards. Ah, Microsoft.

There Are 13 Responses So Far. »

  1. If you have the web access for exchange available, you can use WebDAV to query the calendars that you have access to.

  2. I do have web access. I will explore the WebDAV angle. Thanks!

  3. hey Adam,

    You can also use Python to access your Outlook calendar, I wrote an app that extracted my calendar using Python a couple months ago:

    http://cephas.net/blog/2004/09/17/sending_your_outlook_calendar_using_python.html

    AJ

  4. I did a similar thing with my iCal calendars, which I push to a DAV server. For syncing that with the salesforce SOAP API, I pull the files back over DAV, parse them in PHP, and use ext/soap to manage the SF syncing. Doing something similar and exposing them over REST instead of pushing them over SOAP would be easy.

  5. Thanks to the good comments above, and after lots of digging around, I have managed to make a successful Outlook Calendar request from PHP using a hacked version of HTTP_Request.

    I modified the package (hurray for open source) to include DAV SEARCH support (which technically isn’t official DAV yet, so it’s not even in the HTTP_DAV_Client package), and I was able to figure out all the authentication settings for my server, and search SQL syntax for pulling Calendar records. (I wish I knew how to do the equivalent of a LIMIT clause, but I’m not sure that’s possible.)

    Since I’m not using Windows, the MAPI angle wasn’t possible. That’s why I went the DAV route, which is less well documented. It’s still partially experimental DAV, so it’s not widely used outside of Outlook/Exchange.

    For my next trick, I will port this to use the JavaScript XMLHTTPRequest object, so it can be embedded directly in the widget instead of requiring a forked PHP CLI process.

  6. Hi Adam,

    I’m really interested in what you are doing with PHP pulling in Outlook Calendar information. I would like to be able to do the same, using the resulting data as an in/out board on our Corporate Intranet (running under Mambo/Joomla).

    Would it be possible to get access to your code so that I could modify it slightly to do what I need it to?

    Regards,

    Paul

  7. I will try and dig it up. I’m not sure where I left in, or what state it is in.

  8. Hey Adam,
    Did you ever publish this PHP source anywhere? If so, where? If not, would you be willing to share it?

  9. If I have a remote web access to Exchange, what for to me such web service?

  10. Hey Adam,
    This seems very interesting. Could this be done the other way around, so that the request for calendar is made from outlook and made to a PHP file.

  11. I’m making the same request. Could I get to look at your PHP code that pulls the MS Exchange Calendar contents. Thanks

  12. Based on popular request, here is the kludgy bit of code I wrote to do this: http://www.trachtenberg.com/exchange.phps

    It uses the PEAR HTTP_Request library. Since I haven’t played with it in years, I don’t know what shape it’s in. I did a minimal clean up to remove my hardcoded information and turn that into variables at the top.

    I tried it just now and I am getting Login Timeout errors, but I don’t have the time to debug this.

    I think the important part is the format of the request headers, url, and body.

    If you get this working, please add a comment here, so people can use what you do.

    Thanks!

  13. You can use header ‘Range’ to request a subset of search results (similar to SQL LIMIT):
    Range: rows=0-9

    The HTTP standard Range request header is defined for specifying the number of bytes returned. When used with the “rows” specifier, the WebDAV engine recognizes it as indicating the set of rows to return.