Exemple #1
0
        private void ShowStoreInTree(IMsgStore store)
        {
            //Add the stuff in this store to the tree
            MapiStoreNode storeNode = new MapiStoreNode(store);
            treeFolders.Nodes.Add(storeNode);

            //Get the ID of the root folder
            ENTRYID rootIpmFolder = MapiUtils.GetEntryIdProperty(store, Tags.PR_IPM_SUBTREE_ENTRYID);

            MAPI33.MAPI.TYPE objType;
            IUnknown unk;
            Error hr = store.OpenEntry(rootIpmFolder, Guid.Empty, 0, out objType, out unk);
            if (hr != Error.Success) {
                throw new MapiException(hr);
            }

            using (unk) {
                IMAPIFolder folder = (IMAPIFolder)unk;
                using (folder) {
                    ShowFolderInTree(storeNode, folder);
                }
            }
        }