Programmatically Collapse Outlook Panel?

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

Programmatically Collapse Outlook Panel?
 
Rob Furber




Posts: 7
Joined: 2006-07-22
Hi

I am using ADX V3.3 and was wondering if there is a way to programmatically collapse an Outlook explorer panel (not using the Show() Hide() methods) in the same way that is achieved by clicking on the the splitter during runtime.

I would like to be able to to this because the collapsed state of the panel is shared between all folders, but if you use the Show() Hide() methods then the panel is only hidden for the folder you are currently in and if you navigate to another folder it reappears.

ADX V3.3 for VS 2005
Outlook 11.8118.8107

Thanks,
Posted 20 Feb, 2007 07:27:40 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Rob.

There is not such possibility in the Outlook Object Model.


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.

Posted 20 Feb, 2007 08:16:17 Top
Rob Furber




Posts: 7
Joined: 2006-07-22
Is it possible to achieve what I would like to achieve without having to use the ExplorerLayout or Enabled properties?

I am asking this because in version 2.7 it was possible to change the explorer layout property of a panel in a folder from Unknown to say RightSubpane and it would be appear instantly but in version 3.3 you seem to have to navigate away from the folder and then back again to get the panel to appear.

Thanks,
Posted 20 Feb, 2007 09:18:24 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Rob,

Do you mean changing ExplorerLayout in the ADXBeforeFormShow event?
Posted 20 Feb, 2007 12:30:25 Top
Rob Furber




Posts: 7
Joined: 2006-07-22
No, I mean changing the ExplorerLayout of a panel for the current folder.

For example if I am in the inbox and have a RightSubPane panel, and I then change the ExplorerLayout to Unknown the panel disappears which is fine however if I then change the ExplorerLayout to RightSubPane again then in V2.7 it would reappear however in V3.3 I have to navigate away from the Inbox and then back again for the panel to reappear.

Essentially what I am trying to do is to have button on the toolbar that allows the user to show/hide a custom panel and have that apply to all mail folders. I am trying to do this using the ExplorerLayout property because this method is faster than using the enabled property because the panel is not destroyed.
Posted 21 Feb, 2007 04:33:36 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Rob,

In V3.3 you can call the ADXOlForm.Hide/Show method.
Before the Show method you should be prevent form displaying in the ADXOlForm.ADXBeforeFormShow event.

Also see the following topic http://www.add-in-express.com/forum/read.php?FID=5&TID=1788&MID=8550&phrase_id=383069#message8550
Posted 21 Feb, 2007 11:06:45 Top
Rob Furber




Posts: 7
Joined: 2006-07-22
The ADXOlForm.Hide/Show method doesn't seem to work properly when the ExplorerLayout is set to WebViewPanel, instead of the normal Outlook view returning when you call Hide, the panel disappears and leaves behind a large white area.
Posted 22 Feb, 2007 06:05:14 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Rob,

See the following example that makes the switching between regular and WebViewPane views http://www.add-in-express.com/projects/adx-x-ol-3-webviewpane_switching.zip

Also see the following topic http://www.add-in-express.com/forum/read.php?FID=5&TID=1752&MID=8052&phrase_id=384130#message8052
Posted 22 Feb, 2007 10:36:05 Top
David Ing




Posts: 39
Joined: 2007-02-16
Hi Fedor,

Thanks for the code, good stuff. I did have a question though.

In my code I always do a Marshal.ReleaseComObject() on any COM objects in the Outlook Object model I reference (that are non-null), as I can see that the reference counts wouldn't be reduced properly otherwise, but I did notice these lines you used in the above example:

object explorer = NewRefObj(this.ExplorerObj);
object folder = NewRefObj(this.FolderObj);

...where NewRefObj looks like this:

internal object NewRefObj(object Obj)
{
if (Obj != null)
{
System.IntPtr m_unk = Marshal.GetIUnknownForObject(Obj);
Marshal.Release(m_unk);
return Marshal.GetObjectForIUnknown(m_unk);
}
return null;
}

Do you need to generally need to do these calls for accessing the references down from the ADX object model. Is it just because you didn't want to reference a library in the example, and normally you wouldn't do it?

Thanks for any advice...
Posted 23 Feb, 2007 11:43:23 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
David,

ExplorerObj, FolderObj properties releases after the ADXOlForm hidding.
The NewRefObj function is needed to increase the reference count.
So I can use reference to ExplorerObj afterwards.

Posted 26 Feb, 2007 08:02:04 Top