send string to form region

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

send string to form region
Need help communicating with a form region  
Joseph S




Posts: 10
Joined: 2015-12-28
I have set up a form region to show when the reading pane is open, and I can change the title for the form.
Except I am having issue understanding how to communicate with the form when it is called from my application.

What I want to be able to do, is when a mail item is selected in Outlook in the Explorer view, it will update the form in the region with the subject of the mailItem. Say update a text box, or label

I cannot figure out how to call, or set a variable in the form, and then have it refresh / update?

I did get this far from other examples:


foreach (AddinExpress.OL.ADXOlFormsCollectionItem itemForm in adxOlFormsManager1.Items)
{
	switch (itemForm.ExplorerLayout)
	{
		case AddinExpress.OL.ADXOlExplorerLayout.TopReadingPane:
			for (int i = 0; i < itemForm.FormInstanceCount; i++)
			{
				AddinExpress.OL.ADXOlForm form = itemForm.FormInstances(i);
				if (form.InspectorObj == OutlookApp.ActiveInspector())
				{
					if (form.Active)
					{
						form.Text = "Out text: " + mailItem.subject;
						
						// What I am trying to do.. This of course does not work
						form.subjectStringVariable = mailItem.subject;
					}
				}
			}
			break;
		case AddinExpress.OL.ADXOlExplorerLayout.Unknown:
			break;
	}
}
Posted 15 Jan, 2017 05:26:21 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Joseph,

Joseph S writes:
if (form.InspectorObj == OutlookApp.ActiveInspector())


This condition may prevent your code from executing. The point is: you deal with an explorer-related layout and form.InspectorObj returns null in this case.

Instead of using the code above, you can use itemForm.GetForm(activeExplorer) to get the form instance embedded in the specified window.

Anyway, after you get an ADXOlForm, you need to cast it to the class type of the form that you use in your project. Say, if you form type is MyADXOlForm1, you cast ADXOlForm to MyADXOlForm1, and call MyADXOlForm1.SubjectStringVariable = {some value};

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jan, 2017 05:16:01 Top
Joseph S




Posts: 10
Joined: 2015-12-28
This is what I ended up with, that worked great. Thank you.


for (int i = 0; i < itemForm.FormInstanceCount; i++)
{
   ADXOlForm_Message frm = itemForm.FormInstances(i) as ADXOlForm_Message;

   // ... Do other stuff here...
}
Posted 17 Jan, 2017 00:05:09 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
You are welcome.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 17 Jan, 2017 03:52:10 Top