Accessing controls on an Outlook Explorer taskpane

Add-in Express™ Support Service
That's what is more important than anything else

Accessing controls on an Outlook Explorer taskpane
 
Mark




Posts: 46
Joined: 2010-08-16
Silly question, but from the AddinModule.cs code, how do I get access to the dialog controls in the task pane I have created within Outlook. It is a task pane for the explorer.

I want to display the senders name in the task pane whenever I select an email. I have done the selection code and can get access to the mail properties, but cannot work out how to update the controls on the task pane.

Thanks

mark
Posted 06 Sep, 2010 10:14:26 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Mark,

You can use the following code:

//ADXOlForm2 code
public void Test()
{
    ADXOlForm1 form = (this.AddinModule as AddinModule).FindForm(CurrentOutlookWindowHandle);
}

//AddinModule Code
public ADXOlForm1 FindForm(IntPtr CurrentOutlookWindowHandle)
        {
            for (int i = 0; i < adxOlFormsCollectionItem1.FormInstanceCount; i++)
            {
                if (adxOlFormsCollectionItem1.FormInstances(i).Visible
                    && !adxOlFormsCollectionItem1.FormInstances(i).Active
                    && CurrentOutlookWindowHandle == adxOlFormsCollectionItem1.FormInstances(i).CurrentOutlookWindowHandle
)
                {
                    return adxOlFormsCollectionItem1.FormInstances(i) as ADXOlForm1 ;
                }
            }
            return null;
        }


Please have a look at the HowTo page of our web site. It contains the How to identify the form in an Outlook advanced form region in C# sample add-in project.
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Sep, 2010 10:52:05 Top