I'm trying to build a tree view of an account's folders but I keep
running into a problem no matter which approach I take. In the code
snippet below I'm using the PopulateTree method recursively to add
nodes to the tree view. This works using the .NET GW API but when I
use SOAP it seems that I get my root folder, my Mailbox (which is
immediately below my root folder) but when the function recurses
against what should be a different list of (sub-) folders I end up
with the root and Mailbox folders in the next call to PopulateTree.

I've also tried doing the first level inline with the initializing
code, calling PopulateTree against each of the folders in the first
level as the parent folders but I still seem to only get the root
folder and Mailbox again within the foreach loop of the PopulateTree
method. Otherwise, I can list all the folders in a text string if I
ask for a recursive listing.

PopulateTree(treeFolders.Nodes[0], "Folders");

private int PopulateTree(TreeNode parentNode,
string parentFolderID)
WR.getFolderListRequest flreq =
new WR.getFolderListRequest();
flreq.recurse = false;
flreq.parent = parentFolderID;

WR.getFolderListResponse flres =

if (flres.status.code != 0) return flres.status.code;

TreeNode localNode;
int folderCount = flres.folders.Length;
foreach (WR.Folder folder in flres.folders)
localNode = parentNode.Nodes.Add(folder.name);
PopulateTree(localNode, folder.id);
localNode = null;

return 0;