HOWTO: Bind to items from CDO/MAPI using WebDAV


Using PR_URL_COMPNAME to bind to an item in WebDAV from CDO/MAPI involves understanding the encoding rules for the Exchange version where the item is homed. These rules are different and incompatiable between Exchange 2000, Exchange 2000 SP 1, and Exchange 2003. These rules are not documented and often require reverse engineering to properly encode URLs.

Reading proptag 0x670E001E via MAPI on a folder or item will return a value such as…


...which can be appended to a URL and used to access and item or folder via WebDAV…


More Information

Flat URLs do not have encoding and escaping rules and will work for folders and items in most every DAV operation with the following exceptions:

- as destination of MOVE or COPY operation
- as a source for a DELETE
- for OWA URL commands, e.g. "?cmd=[foo]"


...You are going to use this property in cases where you are stepping out of CDO 1.21 or MAPI code into WebDAV. The HREF in WebDAV is usually created from the subject that was typed in OL (messages created in OWA typically have a GUID file name). The subject in OL can contain characters that must be encoding for use with DAV similar to URL encoding. Rather than figure out those rules, you can use the Flat URL to get the item. The great thing about the proptag is that it is a direct link between MAPI and WebDAV...