コード例 #1
0
ファイル: ThisAddIn.cs プロジェクト: serbanu/MisysHackathon
        private void EnsureSolutionsModule()
        {
            try
            {
            //Declarations
            Outlook.Folder solutionRoot;
            Outlook.Folder solutionCalendar;
            Outlook.Folder solutionContacts;
            Outlook.Folder solutionTasks;
            bool firstRun = false ;
            Outlook.Folder rootStoreFolder =
            Application.Session.DefaultStore.GetRootFolder()
            as Outlook.Folder;
            //If solution root folder does not exist, create it
            //Note that solution root
            //could also be in PST or custom store
            try
            {
            solutionRoot =
                rootStoreFolder.Folders["Birthday Calendar"]
                as Outlook.Folder;
            }
            catch
            {
            firstRun = true;
            }

            if (firstRun == true)
            {
            solutionRoot =
                rootStoreFolder.Folders.Add("Birthday Calendar",
                Outlook.OlDefaultFolders.olFolderInbox)
                as Outlook.Folder;
            solutionCalendar = solutionRoot.Folders.Add(
                "Solution Calendar",
                Outlook.OlDefaultFolders.olFolderCalendar)
                as Outlook.Folder;
            solutionContacts = solutionRoot.Folders.Add(
                "Solution Contacts",
                Outlook.OlDefaultFolders.olFolderContacts)
                as Outlook.Folder;
            solutionTasks = solutionRoot.Folders.Add(
                "Solution Tasks",
                Outlook.OlDefaultFolders.olFolderTasks)
                as Outlook.Folder;
            }
            else
            {
            solutionRoot =
                rootStoreFolder.Folders["Birthday Calendar"]
                as Outlook.Folder;
            solutionCalendar = solutionRoot.Folders[
                "Solution Calendar"]
                as Outlook.Folder;
            solutionContacts = solutionRoot.Folders[
                "Solution Contacts"]
                as Outlook.Folder;
            solutionTasks = solutionRoot.Folders[
                "Solution Tasks"]
                as Outlook.Folder;
            }
            //Get the icons for the solution
            stdole.StdPicture rootPict =
            PictureDispConverter.ToIPictureDisp(
            OutlookAddIn22.Properties.Resources.BRIDGE)
            as stdole.StdPicture;
            stdole.StdPicture calPict =
            PictureDispConverter.ToIPictureDisp(
            OutlookAddIn22.Properties.Resources.umbrella)
            as stdole.StdPicture;
            stdole.StdPicture contactsPict =
            PictureDispConverter.ToIPictureDisp(
            OutlookAddIn22.Properties.Resources.group)
            as stdole.StdPicture;
            stdole.StdPicture tasksPict =
            PictureDispConverter.ToIPictureDisp(
            OutlookAddIn22.Properties.Resources.SUN)
            as stdole.StdPicture;
            //Set the icons for solution folders
            solutionRoot.SetCustomIcon(rootPict);
            solutionCalendar.SetCustomIcon(calPict);
            solutionContacts.SetCustomIcon(contactsPict);
            solutionTasks.SetCustomIcon(tasksPict);
            //Obtain a reference to the SolutionsModule
            Outlook.Explorer explorer = Application.ActiveExplorer();
            solutionsModule =
            explorer.NavigationPane.Modules.GetNavigationModule(
            Outlook.OlNavigationModuleType.olModuleSolutions)
            as Outlook.SolutionsModule;
            //Add the solution and hide folders in default modules
            solutionsModule.AddSolution(solutionRoot,
            Outlook.OlSolutionScope.olHideInDefaultModules);
            //The following code sets the position and visibility
            //of the SolutionsModule
            if (solutionsModule.Visible == false)
            {
            //Set Visibile to true
            solutionsModule.Visible = true;
            }
            if (solutionsModule.Position != 5)
            {
            //Move SolutionsModule to Position = 5
            solutionsModule.Position = 5;
            }
            //Create instance variable for Outlook.NavigationPane
            Outlook.NavigationPane navPane = explorer.NavigationPane;
            if (navPane.DisplayedModuleCount != 5)
            {
            //Ensure that Solutions Module button is large
            navPane.DisplayedModuleCount = 5;
            }
            }
            catch (System.Exception ex)
            {
            Debug.Write(ex.Message);
            }
        }
コード例 #2
0
        private void EnsureSolutionsModule()
        {
            try
            {
                //Declarations
                Outlook.Folder solutionRoot;
                Outlook.Folder solutionCalendar;
                Outlook.Folder solutionContacts;
                Outlook.Folder solutionTasks;
                bool           firstRun        = false;
                Outlook.Folder rootStoreFolder =
                    Application.Session.DefaultStore.GetRootFolder()
                    as Outlook.Folder;
                //If solution root folder does not exist, create it
                //Note that solution root
                //could also be in PST or custom store
                try
                {
                    solutionRoot =
                        rootStoreFolder.Folders["Solution Demo"]
                        as Outlook.Folder;
                }
                catch
                {
                    firstRun = true;
                }

                if (firstRun == true)
                {
                    solutionRoot =
                        rootStoreFolder.Folders.Add("Solution Demo",
                                                    Outlook.OlDefaultFolders.olFolderInbox)
                        as Outlook.Folder;
                    solutionCalendar = solutionRoot.Folders.Add(
                        "Solution Calendar",
                        Outlook.OlDefaultFolders.olFolderCalendar)
                                       as Outlook.Folder;
                    solutionContacts = solutionRoot.Folders.Add(
                        "Solution Contacts",
                        Outlook.OlDefaultFolders.olFolderContacts)
                                       as Outlook.Folder;
                    solutionTasks = solutionRoot.Folders.Add(
                        "Solution Tasks",
                        Outlook.OlDefaultFolders.olFolderTasks)
                                    as Outlook.Folder;
                }
                else
                {
                    solutionRoot =
                        rootStoreFolder.Folders["Solution Demo"]
                        as Outlook.Folder;
                    solutionCalendar = solutionRoot.Folders[
                        "Solution Calendar"]
                                       as Outlook.Folder;
                    solutionContacts = solutionRoot.Folders[
                        "Solution Contacts"]
                                       as Outlook.Folder;
                    solutionTasks = solutionRoot.Folders[
                        "Solution Tasks"]
                                    as Outlook.Folder;
                }
                //Get the icons for the solution
                stdole.StdPicture rootPict =
                    PictureDispConverter.ToIPictureDisp(
                        Properties.Resources.BRIDGE)
                    as stdole.StdPicture;
                stdole.StdPicture calPict =
                    PictureDispConverter.ToIPictureDisp(
                        Properties.Resources.umbrella)
                    as stdole.StdPicture;
                stdole.StdPicture contactsPict =
                    PictureDispConverter.ToIPictureDisp(
                        Properties.Resources.group)
                    as stdole.StdPicture;
                stdole.StdPicture tasksPict =
                    PictureDispConverter.ToIPictureDisp(
                        Properties.Resources.SUN)
                    as stdole.StdPicture;
                //Set the icons for solution folders
                solutionRoot.SetCustomIcon(rootPict);
                solutionCalendar.SetCustomIcon(calPict);
                solutionContacts.SetCustomIcon(contactsPict);
                solutionTasks.SetCustomIcon(tasksPict);
                //Obtain a reference to the SolutionsModule
                Outlook.Explorer explorer = Application.ActiveExplorer();
                solutionsModule =
                    explorer.NavigationPane.Modules.GetNavigationModule(
                        Outlook.OlNavigationModuleType.olModuleSolutions)
                    as Outlook.SolutionsModule;
                //Add the solution and hide folders in default modules
                solutionsModule.AddSolution(solutionRoot,
                                            Outlook.OlSolutionScope.olHideInDefaultModules);
                //The following code sets the position and visibility
                //of the SolutionsModule
                if (solutionsModule.Visible == false)
                {
                    //Set Visibile to true
                    solutionsModule.Visible = true;
                }
                if (solutionsModule.Position != 5)
                {
                    //Move SolutionsModule to Position = 5
                    solutionsModule.Position = 5;
                }
                //Create instance variable for Outlook.NavigationPane
                Outlook.NavigationPane navPane = explorer.NavigationPane;
                if (navPane.DisplayedModuleCount != 5)
                {
                    //Ensure that Solutions Module button is large
                    navPane.DisplayedModuleCount = 5;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
        }
コード例 #3
0
ファイル: ThisAddIn.cs プロジェクト: InFlowBPM/InFlow-BPMS
        private void EnsureSolutionsModule()
        {
            // Declarations.
            Outlook.Folder solutionRoot;

            bool firstRun = false;

            Outlook.Folder rootStoreFolder =
                Application.Session.DefaultStore.GetRootFolder()
                as Outlook.Folder;

            try
            {
                rootStoreFolder.Folders["Finanzierungskonzept"].Delete();
            }
            catch
            {
            }

            // If the solution root folder does not exist, create it.
            // Note that the solution root
            // could also be in a PST or custom store.
            try
            {
                solutionRoot =
                    rootStoreFolder.Folders["Finanzierungskonzept"]
                    as Outlook.Folder;
            }
            catch
            {
                firstRun = true;
            }

            if (firstRun == true)
            {
                solutionRoot =
                    rootStoreFolder.Folders.Add("Finanzierungskonzept", Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox)
                    as Outlook.Folder;
            }
            else
            {
                solutionRoot =
                    rootStoreFolder.Folders["Finanzierungskonzept"]
                    as Outlook.Folder;
            }

            solutionRoot.WebViewURL = "http://fk.r-p.at";
            solutionRoot.WebViewOn  = true;
            // Obtain a reference to the Solutions module.
            Outlook.Explorer        explorer        = Application.ActiveExplorer();
            Outlook.SolutionsModule solutionsModule =
                explorer.NavigationPane.Modules.GetNavigationModule(
                    Outlook.OlNavigationModuleType.olModuleSolutions)
                as Outlook.SolutionsModule;
            // Add the solution and hide folders in default modules.
            solutionsModule.AddSolution(solutionRoot,
                                        Outlook.OlSolutionScope.olHideInDefaultModules);
            // The following code sets the position and visibility
            // of the Solutions module.
            if (solutionsModule.Visible == false)
            {
                // Set Visibile to true
                solutionsModule.Visible = true;
            }
            if (solutionsModule.Position != 6)
            {
                // Move SolutionsModule to Position = 5
                solutionsModule.Position = 6;
            }
            // Create an instance variable for the Navigation Pane.
            Outlook.NavigationPane navPane = explorer.NavigationPane;
            if (navPane.DisplayedModuleCount != 6)
            {
                // Ensure that the Solutions module button is large.
                navPane.DisplayedModuleCount = 6;
            }
        }