Communication between Form Region and Ribbon RRS feed

  • Question

  • Hey everyone, 

    I am working on an Addin for Outlook and part of the Addin has a custom Form Region and a button in the Ribbon. My end goal is when pressing that button add an item into the Form Region which I got working 1 way however it is requiring me to find my instance by using a foreach and checking for an instance of my object. 

    Some documentation I found and that got me started however two of the methods do not work for me, just the last.

    Now, the first method (very similar to the second), uses Globals to get the Form Region in specific Inspectors/Explorers. This seems like the easiest (and best) way to do it, and its shown below.

    private void Access_Form_Regions_ByInspector()
        WindowFormRegionCollection formRegions = 
        formRegions.FormRegion1.textBox1.Text = "Hello World";

    Now, FormRegion1 is a Form Region (if I understand this correctly), however my IDE does not suggest nor know that my Form Region is even available to use from this and this is where I'm lost. 

    Using this method I can get my instance and add all the items I want however I do not want to have to search through all of the available Form Regions when I should be able to do this without it.

    internal void Access_All_Form_Regions()
        foreach (Microsoft.Office.Tools.Outlook.IFormRegion formRegion 
            in Globals.FormRegions)
            if (formRegion is FormRegion1)
                FormRegion1 formRegion1 = (FormRegion1)formRegion;
                formRegion1.textBox1.Text = "Hello World";

    I'm not sure if I'm missing something but the documentation does not seem to be making sense here at all, and I have went through all of the related documents looking to see if I missed something and I don't see how I did.

     Side note: I am building the form in VS, I did not create it in Outlook and import into my project.

    Thursday, June 19, 2014 5:54 PM

All replies

  • Hello Durph,

    You use the right way for accessing the form region instance. There is no other "simpler" way to get it.

    Do you get any errors or exceptions in the code?

    Thursday, June 19, 2014 6:36 PM