0
votes

I am working on Outlook add-in which would pull the list of pre-defined categories from shared mailbox. User then assign each email from shared mailbox to those categories.

My issue is I can get access to all categories linked to account using

Outlook.Application application = new Outlook.Application();
Outlook.Categories categories = application.Session.Categories;

but can't find a way to get categories linked to shared mailbox.

Is there any way to get shared mailbox categories? If not, how would I deal with this scenario, so later on I can create view based on those categories.

Thank you in advance.

2

2 Answers

1
votes

Categories are stored in a hidden message with the message class of "IPM.Configuration.CategoryList" in the store's Calendar folder. You can see it in OutlookSpy if you go to the shared Calendar folder and click the IMAPIFolder button, then go to the "Associated Contents" tab.

That hidden message can be accessed using MAPIFolder.GetStorage in the Outlook Object Model.

You can also access the Categories collection in Redemption (I ma its author) using RDOCategories collection. Redemption exposes categories both on the session level (RDOSession.Categories from the default store) and on the store level (RDOStore2.Categories). A shared mailbox can be opened using RDOSession.GetSharedMailbox.

0
votes

Following is the code to get Categories of selected folder.

public void LoadCategories()
    {
        CategoriesCombo.Items.Clear();
        Outlook.Application application = new Outlook.Application();
        Outlook.NameSpace ns = application.GetNamespace("MAPI");
        Outlook.MAPIFolder selectedFolder = application.ActiveExplorer().CurrentFolder;

        if (selectedFolder is Outlook.MAPIFolder)
        {
            Outlook.Folder folder = selectedFolder as Outlook.Folder;
            Outlook.Store store = folder.Store;
            Outlook.Categories categories = store.Categories;
        }
    }

If someone has better answer, I would look forward to see it.