Bonjour,

Je travaille actuellement sur un Add-in dans Outlook qui concerne uniquement les messages électronique.

Grâce à IRibbonExtensibility j'arrive à créer un ruban facilement avec du XML.
Mon problème réside dans le fait que je n'arrive pas à limiter l'apparition du ruban aux seuls éléments qui concernent les messages éléctroniques.

Pour le moment j'ai réussi à afficher le ruban dans les fenêtres de composition et de lecture du message et à le masquer sur quelques écrans.

Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
String IRibbonExtensibility.GetCustomUI(String ribbonID)
        {
            String XmlRibbonDefinition = "NormalUI.xml";
            if (ribbonID.StartsWith("Microsoft.Outlook"))
            {
                XmlRibbonDefinition = "OutlookExplorerUI.xml";
                if (ribbonID.StartsWith"Microsoft.Outlook.Mail") XmlRibbonDefinition = "OutlookMailUI.xml";
 
                if ((ribbonID.StartsWith("Microsoft.Outlook.MeetingRequest"))
                    || (ribbonID == "Microsoft.Outlook.Appointment") || (ribbonID == "Microsoft.Outlook.Contact")
                    || (ribbonID == "Microsoft.Outlook.Journal") || (ribbonID == "Microsoft.Outlook.Task")
                     || (ribbonID == "Microsoft.Outlook.DistributionList") || (ribbonID == "Microsoft.Outlook.Task")
                    || (ribbonID == "Microsoft.Outlook.Report") || (ribbonID == "Microsoft.Outlook.Resend")
                    || (ribbonID.StartsWith("Microsoft.Outlook.Response")) || (ribbonID == "Microsoft.Outlook.RSS")
                    || (ribbonID.StartsWith("Microsoft.Outlook.Post")) || (ribbonID.StartsWith("Microsoft.Outlook.Sharing")))
                {
                    XmlRibbonDefinition = String.Empty;
                }
            }
 
            if (XmlRibbonDefinition != String.Empty)
            {
                Assembly executingAssembly = Assembly.GetExecutingAssembly();
                foreach (String assemblyName in executingAssembly.GetManifestResourceNames())
                {
                    if (assemblyName.EndsWith(XmlRibbonDefinition))
                    {
                        TextReader xmlReader = new StreamReader(executingAssembly.GetManifestResourceStream(assemblyName));
                        String xmlRibbon = xmlReader.ReadToEnd();
                        xmlReader.Close();
                        return xmlRibbon;
                    }
                }
            }
            return String.Empty;
        }

Si je me fie à tout ce que j'ai pu trouver jusqu'à maintenant, le ruban correspondant la liste des messages correspond à "Microsoft.Outlook.Explorer". Sauf que le ruban des modules "Contacts", "Calendrier" et "Tâches" y sont également rattachés.
J'ai donc essayé d'ajouter un attribut "getVisible" dans le XML et d'y associer une méthode de ma class "Connect" mais je ne sais pas comment savoir dans quel module je me trouve.

Le but final est d'afficher mon onglet uniquement si je suis dans le module "Courrier".