none
C# Outlook Add-in get list of recently accessed folders under the "move" menu item from the context menu. RRS feed

  • Question

  • Hi,

    Is there a way to get the list of recently accessed folders, under the "move" menu item from the context menu in email view? See image below.

    Thanks, 

    Benjamin

    Tuesday, November 12, 2013 9:37 AM

Answers

  • Hi,

    According to your description, you want to get the list of recently accessed folders with “Microsoft.Office.Interop.Outlook”.

    However, I’m afraid there is no such method to get the recently used folder list via the Outlook Object model.

    We could only get all the folders contained in the specified NameSpace by NameSpace.Folders Property.

    Here is a sample to get list of all Outlook folders and subfolders for your reference:

    Outlook.Application app = new Outlook.Application();
    Outlook.NameSpace olNS = app.Application.GetNamespace("MAPI");        
    foreach (Outlook.MAPIFolder folder in olNS.Folders)
    {
        GetFolders(folder);
    }
    
    public void GetFolders(Outlook.MAPIFolder folder)
    {
        if (folder.Folders.Count == 0)
        {
            Console.WriteLine(folder.FullFolderPath);
        }
        else
        {
            foreach (Outlook.MAPIFolder subFolder in folder.Folders)
            {
                GetFolders(subFolder);
            }
        }
    }
    

    When you click the “Other Folder”, under the "move" menu item, you will access to all of the folders.

    If you have any feedback for the Office Developer Platform, please feel free to submit your feedback to User Voice.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Benjamin Penn Thursday, November 14, 2013 2:09 AM
    Thursday, November 14, 2013 1:45 AM
    Moderator

All replies

  • Hi,

    According to your description, you want to get the list of recently accessed folders with “Microsoft.Office.Interop.Outlook”.

    However, I’m afraid there is no such method to get the recently used folder list via the Outlook Object model.

    We could only get all the folders contained in the specified NameSpace by NameSpace.Folders Property.

    Here is a sample to get list of all Outlook folders and subfolders for your reference:

    Outlook.Application app = new Outlook.Application();
    Outlook.NameSpace olNS = app.Application.GetNamespace("MAPI");        
    foreach (Outlook.MAPIFolder folder in olNS.Folders)
    {
        GetFolders(folder);
    }
    
    public void GetFolders(Outlook.MAPIFolder folder)
    {
        if (folder.Folders.Count == 0)
        {
            Console.WriteLine(folder.FullFolderPath);
        }
        else
        {
            foreach (Outlook.MAPIFolder subFolder in folder.Folders)
            {
                GetFolders(subFolder);
            }
        }
    }
    

    When you click the “Other Folder”, under the "move" menu item, you will access to all of the folders.

    If you have any feedback for the Office Developer Platform, please feel free to submit your feedback to User Voice.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Benjamin Penn Thursday, November 14, 2013 2:09 AM
    Thursday, November 14, 2013 1:45 AM
    Moderator
  • Thanks Luna.
    Thursday, November 14, 2013 2:09 AM