Outlook Web Access (OWA) V0.6

I have created a Tcl package for access to Microsoft Exchange Outlook Web Access servers. The package is dependent on Jean-Claude Wippler's webdav package and on TclXML. Thanks are due to Jean-Claude both for his package and for his help.

The owa package is available as a tcl file or as part of the owaSync starkit. This package is now mainly used to support my OWA Synchronisation application. The IMAP to OWA proxy is now obsolete and no longer maintained as the Mail folder synchronisation code in owaSync provides a much more robust solution.

Copyright (C) 2005, 2006 Graham R. Cobb

OWA For TCL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

OWA For TCL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

There are two parts of the owa package:

Utility routines

::owa::connect url ?options?

This is just a wrapper for the ::webdav::connect routine. One day it may be enhanced to return an OWA-specific object but for now it just returns a webdav object. Typical usage:

::owa::connect http://owa.server.org/exchange/user/ -username userid -password mypassword

Note: if you need to use https: you will need to enable TLS before calling ::owa::connect as follows:

package require tls
http::register https 443 ::tls::socket

::owa::fetch dav path

This fetches the text of an OWA object (mail message, notes, etc.).

::owa::fetch-no-headers dav path

This fetches the body of an OWA object (mail message, etc.) without mail headers. The effects are undefined if the object is not a mail message!

::owa::fetch-xml dav path

This fetches the OWA object properties in XML (using a Webdav PROPFIND operation). It is up to the caller to parse the XML. Note that the properties do not necessarily include the actual object contents (for example text of Notes is not returned).

::owa::list dav path

This returns a list of the names of the objects contained within the directory.

Note: it is possible to use ::webdav::search directly to perform more complicated lookups, but this requires creating an XML query and analysing the XML response, and is slower.

Replication routines

All these routines reside within the ::owa::sync namespace.

OWA replication involves working with the concept of an "OWAsync collection". A collection is an OWA folder, possibly with an SQL WHERE clause restricting the objects which form the collection. Neither the folder name nor the WHERE clause can be changed during the life of the collection.

OWA tracks the state of the collection and returns, on request, the list of changes that have been made to the collection.

Note: the current version of the owa package handles receiving collection updates from OWA but does not handle making updates to OWA. Thus it can be used to keep another copy in sync with the OWA version but does not handle propagating updates to the OWA version.

Users are advised to check out the Microsoft Exchange SDK, particularly the Webdav Replication section, for more information.

::owa::sync::create dav path ?where? ?collblob?

This creates a new OWAsync collection object.

Note that the create call does not actually contact the server to validate the parameters. If there is an error, it will not be noticed until the manifest procedure is called.

$coll kill

Note that this can also be called as ::owa::sync::kill coll.

This deletes the specified OWAsync collection object.

$coll reset

Note that this can also be called as ::owa::sync::reset coll.

This resets the collection to forget the previous state. The next call to manifest will return all the current members of the collection but no information on updates.

$coll serial

Note that this can also be called as ::owa::sync::serial coll.

This serialises the internal state of the OWAsync object so that it may, for example, be stored in a file and restored at a later date. The returned value is a list of even length consisting of pairs in the form of a keyword and a value (similar to the format returned by array get).

The list should not be modified, except that additional keyword and value pairs can be added if the caller wishes (for example if they want to store additional information of their own). Unrecognised keywords will be ignored when restoring.

Note the data does not include any information about the webdav connection. The caller is responsible for re-establishing a webdav collection before restoring the state.

::owa::sync::recreate dav data

This restores the internal state of a OWAsync object from the data returned from a previous serial command. This is useful if state needs to be stored in a file and restored at a later date.

The return value is a new OWAsync collection object.

$coll manifest

Note that this can also be called as ::owa::sync::manifest coll.

This procedure returns all the changes to the collection since the last call to manifest.

The return value is a list of five element lists. Each quintuplet represents a changed element in the collection. The quintuplets are {path resourceid change repl-uid displayname} where:

The path and displayname will be empty if the change is "delete".

Changes

In version 0.1

Initial release.

In version 0.2

Changes to support IMAP2OWA.

Add fetch-no-headers.

In version 0.3

Changes to support owaSync.

Add fetch-xml.

In version 0.4

Change keywords used when saving and restoring collection state. Previous keywords will be supported for one release.

In version 0.5

Handle folder names with spaces

In version 0.6

Reset parser after use (issue for Windows support)

Example

See the owaSync package as an example of using this.

Contacting me

Please contact me by email on owa-tcl AT cobb.uk.net.

If you use this, please let me know of your experience. In return I will let you know of any updates.


This page has been accessed Access counter times.

Graham Cobb
Creative Commons License
This web page is licensed under a Creative Commons Attribution-ShareAlike 2.0 License.