How to Expand OutlookFormRegion in C#?

Jhan Zaib 1 Reputation point
2022-12-22T13:13:30.493+00:00

I am facing am issue in Outlook VSTO addIn where OutlookFormRegion is used in Adjoining FormRegionType. So is there a way to change its state i.e. expand (if region is collapsed) via C#?

I could not find a location where this state persists? In my opinion, we can change this by accessing this?

I have tried this solution https://social.msdn.microsoft.com/Forums/en-US/7b84f76d-66d0-454f-904f-21b880ca2144/outlook-form-region-collapse-by-default-on-opening-c?forum=outlookdev but this did not work for me.

Also share your thoughts if we can disable this expand/collapse option?

Any idea?

Microsoft 365 and Office | Development | Other
{count} votes

1 answer

Sort by: Most helpful
  1. TechLife 246 Reputation points
    2023-01-01T00:57:11.307+00:00

    You can use the FormRegion.IsExpanded property to check if the form region is currently expanded or collapsed. To expand or collapse the form region, you can use the FormRegion.Expanded property. Here's an example of how you can use these properties to expand the form region if it is currently collapsed:

    Outlook.FormRegion formRegion = // get a reference to the form region  
    if (!formRegion.IsExpanded)  
    {  
        formRegion.Expanded = true;  
    }  
      
    

    Note that this will only work if the form region is of type AdjoiningFormRegion, which supports expanding and collapsing. If the form region is of a different type, this property will not be available.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.