none
How to set custom icon for Solution module in Outlook VSTO Add-In RRS feed

  • Question

  • I have a VSTO solution built for Outlook 2010, and add Solution module programingly, there is  a default icon(3 cubes and 1 plus like MFC app icon for C++) showing up for Solution module, looks there is no way to change the icon for it. Anyone know it is possible to achieve it? 

    Friday, June 8, 2012 1:31 PM

Answers

  • That's correct. Unfortunately, you can only set the icon for the SolutionsModule root folder and subfolders under the root, not the icon of the SolutionsModule indicator in the NavigationPane. All SolutionsModules installed by all running addins share that indicator and that's why any one addin isn't allowed to change the icon, it would affect every one of the modules.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Johnnie.Zhou" <=?utf-8?B?Sm9obm5pZS5aaG91?=> wrote in message news:dbe03fce-99e2-4c2a-8c57-98b472479717...

    Ken, thanks for your reply, but you are only able to change folder's icon, not the solution module. Here is the code I have, can you give some clue? I don't find any method ot set icon for SolutionModule.

    thanks again for reply.

    rootStoreFolder = Utility.Folder.GetRootFolder(this.Application.Session);
                    goldFolder = Utility.Folder.GetFolder(rootStoreFolder, Properties.Resources.GoldFolderName);
                    if (goldFolder == null)
                    {
                        goldFolder = rootStoreFolder.Folders.Add(Properties.Resources.GoldFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                        pipelineFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.PipelineFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                        calendarFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.CalendarFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        archiveFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.ArchiveFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        emailFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.EmailFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        aboutFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.AboutFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                    }
                    Outlook.SolutionsModule solutionModule = this.explorer.NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleSolutions) as Outlook.SolutionsModule;
                    
                    goldPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.GoldBar16) as StdPicture;
                    pipelinePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.pipeline16) as StdPicture;
                    calendarPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.calendar16) as StdPicture;
                    archivePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.archive16) as StdPicture;
                    aboutPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.about16) as StdPicture;
                    emailPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.email16) as StdPicture;
                    goldFolder.SetCustomIcon(goldPic);
                    pipelineFolder.SetCustomIcon(pipelinePic);
                    calendarFolder.SetCustomIcon(calendarPic);
                    archiveFolder.SetCustomIcon(archivePic);
                    emailFolder.SetCustomIcon(emailPic);
                    aboutFolder.SetCustomIcon(aboutPic);
                    solutionModule.AddSolution(goldFolder, Outlook.OlSolutionScope.olHideInDefaultModules);
                    if (solutionModule.Visible == false)
                    {
                        solutionModule.Visible = true;
                    }
                    if (solutionModule.Position != 5)
                    {
                        solutionModule.Position = 5;
                    }
                    Outlook.NavigationPane navPane = this.explorer.NavigationPane;
                    if (navPane.DisplayedModuleCount != 5)
                    {
                        navPane.DisplayedModuleCount = 5;
                    }


    Ken Slovak MVP - Outlook
    • Marked as answer by Johnnie.Zhou Friday, June 8, 2012 4:06 PM
    Friday, June 8, 2012 3:35 PM

All replies

  •  
    You use Folder.SetCustomIcon to pass an IPictureDisp (StdPicture) object to set the icon for the SolutionsModule Folder.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Johnnie.Zhou" <=?utf-8?B?Sm9obm5pZS5aaG91?=> wrote in message news:1d2eea1e-df99-4615-8dbc-8ad905b4a4fb...

    I have a VSTO solution built for Outlook 2010, and add Solution module programingly, there is  a default icon(3 cubes and 1 plus like MFC app icon for C++) showing up for Solution module, looks there is no way to change the icon for it. Anyone know it is possible to achieve it? 


    Ken Slovak MVP - Outlook
    Friday, June 8, 2012 2:58 PM
  • Ken, thanks for your reply, but you are only able to change folder's icon, not the solution module. Here is the code I have, can you give some clue? I don't find any method ot set icon for SolutionModule.

    thanks again for reply.

    rootStoreFolder = Utility.Folder.GetRootFolder(this.Application.Session);
                    goldFolder = Utility.Folder.GetFolder(rootStoreFolder, Properties.Resources.GoldFolderName);
                    if (goldFolder == null)
                    {
                        goldFolder = rootStoreFolder.Folders.Add(Properties.Resources.GoldFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                        pipelineFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.PipelineFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                        calendarFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.CalendarFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        archiveFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.ArchiveFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        emailFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.EmailFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        aboutFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.AboutFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                    }
                    Outlook.SolutionsModule solutionModule = this.explorer.NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleSolutions) as Outlook.SolutionsModule;
                    
                    goldPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.GoldBar16) as StdPicture;
                    pipelinePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.pipeline16) as StdPicture;
                    calendarPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.calendar16) as StdPicture;
                    archivePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.archive16) as StdPicture;
                    aboutPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.about16) as StdPicture;
                    emailPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.email16) as StdPicture;
                    goldFolder.SetCustomIcon(goldPic);
                    pipelineFolder.SetCustomIcon(pipelinePic);
                    calendarFolder.SetCustomIcon(calendarPic);
                    archiveFolder.SetCustomIcon(archivePic);
                    emailFolder.SetCustomIcon(emailPic);
                    aboutFolder.SetCustomIcon(aboutPic);
                    solutionModule.AddSolution(goldFolder, Outlook.OlSolutionScope.olHideInDefaultModules);
                    if (solutionModule.Visible == false)
                    {
                        solutionModule.Visible = true;
                    }
                    if (solutionModule.Position != 5)
                    {
                        solutionModule.Position = 5;
                    }
                    Outlook.NavigationPane navPane = this.explorer.NavigationPane;
                    if (navPane.DisplayedModuleCount != 5)
                    {
                        navPane.DisplayedModuleCount = 5;
                    }

    Friday, June 8, 2012 3:18 PM
  • That's correct. Unfortunately, you can only set the icon for the SolutionsModule root folder and subfolders under the root, not the icon of the SolutionsModule indicator in the NavigationPane. All SolutionsModules installed by all running addins share that indicator and that's why any one addin isn't allowed to change the icon, it would affect every one of the modules.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Johnnie.Zhou" <=?utf-8?B?Sm9obm5pZS5aaG91?=> wrote in message news:dbe03fce-99e2-4c2a-8c57-98b472479717...

    Ken, thanks for your reply, but you are only able to change folder's icon, not the solution module. Here is the code I have, can you give some clue? I don't find any method ot set icon for SolutionModule.

    thanks again for reply.

    rootStoreFolder = Utility.Folder.GetRootFolder(this.Application.Session);
                    goldFolder = Utility.Folder.GetFolder(rootStoreFolder, Properties.Resources.GoldFolderName);
                    if (goldFolder == null)
                    {
                        goldFolder = rootStoreFolder.Folders.Add(Properties.Resources.GoldFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                        pipelineFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.PipelineFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                        calendarFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.CalendarFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        archiveFolder = Utility.Folder.CreateFolder(
                            goldFolder, Properties.Resources.ArchiveFolderName, Outlook.OlDefaultFolders.olFolderInbox);
                                            
                        emailFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.EmailFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        aboutFolder = Utility.Folder.CreateFolder(goldFolder, Properties.Resources.AboutFolderName, Outlook.OlDefaultFolders.olFolderInbox);                    
                        
                    }
                    Outlook.SolutionsModule solutionModule = this.explorer.NavigationPane.Modules.GetNavigationModule(Outlook.OlNavigationModuleType.olModuleSolutions) as Outlook.SolutionsModule;
                    
                    goldPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.GoldBar16) as StdPicture;
                    pipelinePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.pipeline16) as StdPicture;
                    calendarPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.calendar16) as StdPicture;
                    archivePic = PictureDispConverter.ToIPictureDisp(Properties.Resources.archive16) as StdPicture;
                    aboutPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.about16) as StdPicture;
                    emailPic = PictureDispConverter.ToIPictureDisp(Properties.Resources.email16) as StdPicture;
                    goldFolder.SetCustomIcon(goldPic);
                    pipelineFolder.SetCustomIcon(pipelinePic);
                    calendarFolder.SetCustomIcon(calendarPic);
                    archiveFolder.SetCustomIcon(archivePic);
                    emailFolder.SetCustomIcon(emailPic);
                    aboutFolder.SetCustomIcon(aboutPic);
                    solutionModule.AddSolution(goldFolder, Outlook.OlSolutionScope.olHideInDefaultModules);
                    if (solutionModule.Visible == false)
                    {
                        solutionModule.Visible = true;
                    }
                    if (solutionModule.Position != 5)
                    {
                        solutionModule.Position = 5;
                    }
                    Outlook.NavigationPane navPane = this.explorer.NavigationPane;
                    if (navPane.DisplayedModuleCount != 5)
                    {
                        navPane.DisplayedModuleCount = 5;
                    }


    Ken Slovak MVP - Outlook
    • Marked as answer by Johnnie.Zhou Friday, June 8, 2012 4:06 PM
    Friday, June 8, 2012 3:35 PM
  • Thanks for your answer Ken. your explaination make more sense, hope in future version we can have the ability to customize it. sometime it's intuitive to user if they used to their legacy system icon.
    Friday, June 8, 2012 4:12 PM