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;
}
}
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
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};
Andrei Smolin
Add-in Express Team Leader |
|
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...
}
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
You are welcome.
Andrei Smolin
Add-in Express Team Leader |
|