locked
Picklist of public folders RRS feed

  • Question

  • Hi

    I am new to add-in's. I am using vs 2005 and vsto to create an addin in outlook.

    I would like to create a picklist of public folders for a user to select.

    I have not had much luck at progressing beyond iterating through the top level of folders.

    This is what I have so far. in my ThisApplication_Startup function

    Dim AllFolders As Microsoft.Office.Interop.Outlook.Folders = Me.ActiveExplorer().Session.Folders

    For Each Folder As Outlook.MAPIFolder In AllFolders

    MsgBox("folder " & Folder.Name)

    Next

    I can't seem to get the subfolders below the top level.

    Alternatively I have tried to invoke PickFolder (is it a built in dialog like OpenFileDialog) but with no luck.

    Any help greatly appreciated

    Thanks

    Col

     

     

    Sunday, February 5, 2006 10:46 PM

Answers

  • Hi,

    You can get the subfolders beacuse you interate only through the top folders. You need to change your code to check if the top folder has subfolders (Folder.Folders.Count > 0) and then iterate again through Folder.Folders collection. But maybe the easiest way to do it is to use PickFolder method:

    Dim
    selectedFolder As Outlook.MAPIFolder = Me.ActiveExplorer().Session.PickFolder()

    This code will display the PickFolder dialog where your users you can select a folder.

    Hope this helps.

    Monday, February 6, 2006 9:56 AM

All replies

  • Hi,

    You can get the subfolders beacuse you interate only through the top folders. You need to change your code to check if the top folder has subfolders (Folder.Folders.Count > 0) and then iterate again through Folder.Folders collection. But maybe the easiest way to do it is to use PickFolder method:

    Dim
    selectedFolder As Outlook.MAPIFolder = Me.ActiveExplorer().Session.PickFolder()

    This code will display the PickFolder dialog where your users you can select a folder.

    Hope this helps.

    Monday, February 6, 2006 9:56 AM
  • Thanks Peter

    I just couldn't get the syntax right. on that pickfolder. It works fine now.

    Cheers

    Colin

    Monday, February 6, 2006 11:26 AM