The IMAPIContainer::GetHierarchyTable method returns a pointer to the container's hierarchy table.
See IMAPIContainer : IMAPIProp.
HRESULT GetHierarchyTable(
ULONG ulFlags,
LPMAPITABLE FAR * lppTable
);
The IMAPIContainer::GetHierarchyTable method returns a pointer to the hierarchy table of a container. A hierarchy table holds summary information about the child containers within the container. Folder hierarchy tables hold information about child folders; address book hierarchy tables hold information about child address book containers and distribution lists.
It is possible for some containers to have no child containers. These containers return MAPI_E_NO_SUPPORT from their implementations of GetHierarchyTable.
When the CONVENIENT_DEPTH flag is set, each row in the hierarchy table also includes the PR_DEPTH property as a column. PR_DEPTH indicates the level of each container relative to the container implementing the table. The implementing container's immediate child containers are at depth zero, child containers within the zero depth containers are at depth one, and so on. The values of PR_DEPTH increase sequentially as the hierarchy of levels deepens.
For a complete list of required and optional columns in hierarchy tables, see Hierarchy Tables.
If you support a hierarchy table for your container, you must also:
String and binary contents table columns can be truncated. Typically, providers return 255 characters. Because you cannot know ahead of time whether or not a table includes truncated columns, assume that a column is truncated if the length of the column is either 255 or 510 bytes. You can always retrieve the full value of a truncated column if necessary from the object directly by using its entry identifier to open it and then calling the IMAPIProp::GetProps method.
Depending on the provider's implementation, restrictions and sorting operations can apply to an entire string or to the truncated version of that string.
IMAPIProp::GetPropList, IMAPIProp::GetProps, IMAPITable : IUnknown, PR_CONTAINER_HIERARCHY