Beispiel #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // To iterate through folders:
        //		-first open up a MAPI session and login
        //		-then open the message store you want to access
        //		-then open the folder and get the hierarchy table
        //		-iterate through the folders using GetNextFolder()
        //		
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static void FolderTest(NetMAPI mapi)
        {
            // another way to do this is with the line below
            // if (mapi.OpenRootFolder()) EnumerateSubFolders(mapi.Folder); 

            if (mapi.OpenRootFolder() && mapi.GetHierarchy()) 
            {
                StringBuilder s = new StringBuilder(NetMAPI.DefaultBufferSize);
                MAPIFolder folder;
                while (mapi.GetNextSubFolder(out folder, s))
                {
                    Console.WriteLine("Folder: " + s.ToString());
                    EnumerateSubFolders(folder);
                    folder.Dispose();
                }
            }
        }