Implementing Folders for Remote Transports

Since the folder that remote transport providers implement is not a fully functional MAPI folder, remote transport providers do not have to implement all the methods in the IMAPIFolder interface. You do need to implement the IMAPIFolder::SetMessageStatus method. You should derive a C++ class from the IMAPIFolder interface to implement the folder. Because IMAPIFolder inherits from the IMAPIContainer, IMAPIProp, and IUnknown interfaces, there are some methods from those interfaces that need to be implemented as well. Methods from those interfaces that are not listed here should be implemented as stubs which return MAPI_E_NO_SUPPORT.

IMAPIFolder is a pure virtual interface, containing no data members or predefined methods, only method declarations. You must implement basic functionality such as a constructor and destructor, reference counting, and declaring and defining any needed member variables. Your class's declaration should include data members for the folder's contents table, a pointer to the logon object and status object (the parent objects of the folder), and a reference counter.

Since the IMAPIFolder interface itself does not define any mechanism for filling the contents table with message headers, you will need to define custom methods to do this. The minimum implementation of this interface has read-only functionality. You will need to implement additional methods to give your implementation read/write functionality.

The only method from the IMAPIContainer interface that must be fully implemented is GetContentsTable. The remaining methods can return MAPI_E_NO_SUPPORT.

Remote transport providers must implement only four methods from the IMAPIProp interface in addition to the usual stubs for the other methods in this interface. The required IMAPIProp methods are:

GetLastError

SaveChanges

GetProps

GetPropList

Because MAPI adheres to the OLE component object model, you must implement a few methods from IUnknown.

The semantics of the QueryInterface method that your implementation should follow are described in the Platform SDK. If the interface identifier passed into QueryInterface is one of IID_IMAPIFolder, IID_IMAPIContainer, or IID_IMAPIProp, then a pointer to the folder object should be passed back to the caller in the parameter provided for that purpose, the reference count of the folder must be incremented, and the method should return S_OK.

If the interface identifier passed in is IID_IUnknown, then a pointer to the transport provider's status object should be returned, according to the OLE common object model (COM) rules, and the status object's AddRef method should be called before QueryInterface returns S_OK.

If the interface identifier is anything else, QueryInterface should return MAPI_E_INTERFACE_NOT_SUPPORTED.

Your implementation of IUnknown::Release should do the following things: