Using OLE Documents

Microsoft Exchange Server uses OLE to let users drag documents into information store folders. This action may be taken from locations such as the desktop, the Windows NT Explorer, and the Windows 95 Explorer. This mechanism uses the OLE concept of document objects. For more information on OLE document objects and their property sets, see the COM and ActiveX Object Services section of the Platform SDK.

The Microsoft Exchange Client displays a set of properties about a document according to the current user-defined view. For example, if a Total field in a Microsoft Excel worksheet is published as an OLE document object property, then this worksheet is dragged into a Microsoft Exchange Server public folder, it will be displayed by the client if the Total field is an element of the current view.

Microsoft Exchange clients can create objects for documents dragged into folders, display these objects, and start their native applications. The sequence of actions performed by a Microsoft Exchange Client for each of these tasks is defined as follows:

    To create a document object
  1. The user drags a document into a folder displayed by the client.
  2. The client creates a message and attaches the document to the message as a MAPI attachment.
  3. The client opens an IStorage interface on the document and reads property-set streams.
  4. The client reads OLE document object properties (such as summary properties) from the document object and creates equivalent MAPI properties on the message.
  5. The client sets the message class to IPM.Document.*xxx, where xxx is the file extension (if any) associated with the application.
    To display a document object

As a result of the previous steps, the OLE document object properties now exist as MAPI properties on a message, which the client displays in user-defined views. If the current view includes Item Type, the client displays an appropriate icon for the document. The icon to be used is determined by using the message class IPM.Document.*xxx. For example, the client displays a Microsoft Excel icon if the message class is IPM.Document.*XLS.

    To open a document
  1. The user double-clicks the icon of a document.
  2. The client uses the message class to determine how to display the message. First, if the message class is IPM.Document.*xxx, the client knows it is a message with an attachment to be opened. In contrast, if the message class is IPM.Note, the client displays it as an e-mail message. An attachment, if any, is not opened immediately.
  3. The client locates the attachment and requests that Windows open the document by activating the application with which it is associated.

Third-party client applications can use OLE to perform these same functions. A client application can also use OLE interfaces and document-object properties to write attachment documents into a Microsoft Exchange Server information store.