Hello out there,
im trying to build my first application on Windows forms with C#. Im fighting against the treeview control and MS outlook 2007...
I need a treeview like the Explorer in Outlook 2007, the exchange public folders preselected.
I have created the parent node, but i have problems to get all child nodes.
Now, Im getting only teh first level
Can anyone help? Thanks a lot for wasting your time for my "problem" :)
I started with this code:
private void TreeViewOutlookPublicFolders_Click(object sender, EventArgs e)
{
// Initalisieren der Oulook Session
Microsoft.Office.Interop.Outlook.Application OlApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace OlNs = OlApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder StartFolder = OlNs.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders);
// Display a wait cursor while the TreeNodes are being created.
Cursor.Current = Cursors.WaitCursor;
// Suppress repainting the TreeView until all the objects have been created.
TreeViewOutlookPublicFolders.BeginUpdate();
// Clear the TreeView each time the method is called.
TreeViewOutlookPublicFolders.Nodes.Clear();
TreeNode TRoot = TreeViewOutlookPublicFolders.Nodes.Add(StartFolder.Name);
foreach ( Folder f in StartFolder.Folders)
{
Debug.Print(f.Name);
TRoot.Nodes.Add(f.Name);
}
// Reset the cursor to the default for all controls.
Cursor.Current = Cursors.Default;
// Begin repainting the TreeView.
TreeViewOutlookPublicFolders.EndUpdate();
}