none
Outlook - Form Region - Minimizing not retained while composing new email RRS feed

  • Question

  • Hi,

    We have developed an OutlookAddin which has form regions. While form region is minimized while reading a email, it remain minimized on subsequent emails.

    But, while composing the email, while we minimize the form region, it's getting maximized while composing another email. Is there a way we can make it minimized if we choose it. Is it a bug with compose email window?

    Regards,

    Praveen.V.Nair

    Tuesday, January 2, 2018 4:49 PM

All replies

  • Hi Praveen Anirudh,

    Hi I try to make a test on my side.

    when I run the Addin I find that there are 2 buttons in the Ribbon to switch in between mail message and form region.

    do you have these kind of buttons in your ribbon?

    if no, it is possible that you are using older version of Outlook or your testing method is different then me.

    if so, please try to provide a detailed steps with sample project.

    we will again try to reproduce the issue with your project and try to provide a further suggestions to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 3, 2018 9:01 AM
    Moderator
  • Hi Deepak,

    I am herewith attaching the code snippets below. I am trying to do two things here.

    1. Minimize form region for read pane and mail compose screen. It's working fine except for discarding the mail while replying it.
    2. To overcome above bug, trying to keep a disable button in ribbon to hide form region

    Snapshot of reply email with minimized form region:

    Form Region expanded after discarding the email:

    Code snippets :

     public partial class ThisAddIn
        {
            public MyRibbon myRibbon = null;
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
            }
    
            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
                // Note: Outlook no longer raises this event. If you have code that 
                //    must run when Outlook shuts down, see http://go.microsoft.com/fwlink/?LinkId=506785
            }
    
            #region VSTO generated code
    
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
    
            #endregion
    
            protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
            {
                myRibbon = new MyRibbon();
                return myRibbon;
            }
        }

      [ComVisible(true)]
        public class MyRibbon : Office.IRibbonExtensibility
        {
            private Office.IRibbonUI ribbon;
    
            public MyRibbon()
            {
            }
    
            #region IRibbonExtensibility Members
    
            public string GetCustomUI(string ribbonID)
            {
                return GetResourceText("PeoplePane.MyRibbon.xml");
            }
    
    
            public string GetCollapseLabel(Office.IRibbonControl control)
            {
                return "Collapse Panel";
            }
    
            public string GetExpandLabel(Office.IRibbonControl control)
            {
                return "Expand Panel";
            }
    
    
            #endregion
    
            #region Ribbon Callbacks
            //Create callback methods here. For more information about adding callback methods, visit http://go.microsoft.com/fwlink/?LinkID=271226
    
            public void Ribbon_Load(Office.IRibbonUI ribbonUI)
            {
                this.ribbon = ribbonUI;
            }
    
            #endregion
    
            public bool Control_Visible(Office.IRibbonControl control)
            {
                try
                {   
                    ribbon.InvalidateControlMso("ContextMenuMultipleItems");
                }
                catch (Exception ex)
                {
    
                }
                return false;
            }
    
            #region Helpers
    
            private static string GetResourceText(string resourceName)
            {
                Assembly asm = Assembly.GetExecutingAssembly();
                string[] resourceNames = asm.GetManifestResourceNames();
                for (int i = 0; i < resourceNames.Length; ++i)
                {
                    if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i])))
                        {
                            if (resourceReader != null)
                            {
                                return resourceReader.ReadToEnd();
                            }
                        }
                    }
                }
                return null;
            }
    
            #endregion
    
            public void btnCollapse_Click(Office.IRibbonControl control)
            {
                var formRegions = Globals.FormRegions.FirstOrDefault();
                (formRegions as mypeoplePane).OutlookFormRegion.Visible = false;
            }
    
            public void btnExpand_Click(Office.IRibbonControl control)
            {
                var formRegions = Globals.FormRegions.FirstOrDefault();
                (formRegions as mypeoplePane).OutlookFormRegion.Visible = true;
            }
        }
    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idMso="TabMail">
            <group id="MyRibbon"  label="Region Controls" screentip="My Pane Ribbon">
              <button id="MybtnCollapse"  description="this is test"
                        size="large" getImage="GetIcon"
                        label="Collapse"
                        onAction="btnCollapse_Click"/>
              <button id="MyBtnExpand"  description="this is test"
                        size="large" getImage="GetIcon"
                        label="Expand"
                        onAction="btnExpand_Click"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
      <contextMenus>
        <contextMenu idMso="ContextMenuMultipleItems">
          <button  id="btnCollapse" insertAfterMso="MarkAsUnread" onAction="btnCollapse_Click" getLabel="GetCollapseLabel"/>
          <button  id="btnExpand" insertAfterMso="MarkAsUnread" onAction="btnExpand_Click"  getLabel="GetExpandLabel"/>
        </contextMenu>
      </contextMenus>
    </customUI>


    Thursday, January 4, 2018 11:08 AM
  • Hi Praveen Anirudh,

    I try to create an addin and run the above code.

    still I get the same option.

    I can see the form region in Ribbon and I did not get any other buttons in ribbon.

    also did not get any button in context menu.

    below is the result I get. the Form region on right side is added by your addin.

    let me know which version of Outlook you are using. so if you are using any other version of Outlook then I will try to make a test with that version.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 5, 2018 8:20 AM
    Moderator
  • Hi,

    Please see my attachments in my earlier post. Image 1 shows form region in the bottom in minimized state. Image 2 show form region in maximum state after I have discarded the reply message.

    MSOffice version I am using are Office 2007, Office 2010, Office 2013 and Office 2017. All having the issue except Office 2007 since, it doesn't have the option to discard a message.

    Regards,

    Praveen.V.Nair

    Friday, January 5, 2018 11:05 AM
  • Hi,

    Can someone help me with this query?

    Regards,

    Praveen.V.Nair

    Monday, January 8, 2018 10:47 AM
  • Hi Praveen Anirudh,

    As i showed you before, i am not able to reproduce the issue properly like you show it in image.

    if possible for you then you can try to share your project.

    it is possible that we are missing something in your above description.

    so we will try to again check that project and try to find a solution or a work around fo0r the issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 12, 2018 9:08 AM
    Moderator