Gotcha - PermanentURL & WebDAV Series # 2 - How to access flat URLs using CDO/MAPI

With continuation to previous blog post, this article describes how to access items in a WebDAV application that are identified by using MAPI. The WebDAV application uses flat URLs to access items or folders.

How to use flat URLs to access items by using MAPI ?

  1. Read property tag 0x670E001E by using MAPI on the folder or item to access.

  2. Save the returned value in a variable. The value will resemble the following:


  3. Construct a URL that is used to access the folder or item that is using the flat URL. The URL will resemble the following:


  4. Use the URL in a WebDAV call to access an item.

Best use of Flat URL usage in the Programming

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

  • As destinations of MOVE or COPY operation
  • As a source for a DELETE
  • For Outlook Web Access URL commands; for example, ?cmd=[myCommand].

Use this property when you are stepping out of CDO 1.2.1 or MAPI code into WebDAV. The HREF in WebDAV is usually created from the subject that was typed in Microsoft Outlook. The subject in Outlook can contain characters that are encoded for use with DAV. This encoding resembles URL encoding. Instead of reverse engineering the encoding, use the flat URL to get the item.

Hope this helps.