Custom Task Pane in Outlook question

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

Custom Task Pane in Outlook question
Custom Task Pane in Outlook question 
Goran Vidic




Posts: 61
Joined: 2009-04-24
Hi,

Is it possible (with .NET 2008 Pro version) to implement custom task pane in outlook in such a way that will replace original pane.

Let me explain!

When user click on task item in Tasks (for example), is it possible to show custom form with custom data instead of original pane on righ side (original pane shows some details about currently selected task item).

Also, is it possible to show custom pane only for certain items when user click on them, but, when user click on unwanted item, original pane should be displayed.

Regards


Posted 28 Apr, 2009 11:20:17 Top
Goran Vidic




Posts: 61
Joined: 2009-04-24
I have a picture but I'm not sure how to include that pic. (if possible?)

[img]D:\TaskIssueQuestion.jpg[/img]
Posted 28 Apr, 2009 11:27:23 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Goran,

It looks like you talk about the Preview Pane. You can switch it off or show it in the right and bottom positions using View | Reading Pane in the menu. If it is correct, then you can use the PreviewPane vlue in the ExplorerLayout property of the corresponding item. If the preview pane is off (check the State property of the corresponding command bar button), you can show your form via another item having RightSubpane in its ExplorerLayout property. Also, you can handle the ADXReadingPaneHide, ADXReadingPaneMove, ADXReadingPaneShow events of the Outlook Forms Manager to show the form via this or that item.

Is this what you need?


Andrei Smolin
Add-in Express Team Leader
Posted 28 Apr, 2009 11:53:31 Top
Goran Vidic




Posts: 61
Joined: 2009-04-24
Hello Andrei,

Yes, I'm talking about Preview Pane.
Did you suggest me to switch off this pane programmatically (How to do this? Any tutorial or source code?) and show my custom form as RightSubpane?

Is it possible to place custom form on Preview Pane, replacing original?

Best regards.
Posted 29 Apr, 2009 06:47:26 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Goran,

Below is the code that works in my Outlook 2007:

internal enum ReadingPaneState
{
    Right,
    Bottom,
    Off,
}
private ReadingPaneState ReadingPane(ReadingPaneState State)
{
    ReadingPaneState previousState = ReadingPaneState.Off;
    Outlook.Explorer explorer = OutlookApp.ActiveExplorer();
    Office.CommandBars cmBars = explorer.CommandBars;
    Office.CommandBarControl control = cmBars.FindControl(Type.Missing, 31134, Type.Missing, Type.Missing);
    Office.CommandBarPopup rpPopup = control as Office.CommandBarPopup;
    if (rpPopup != null)
    {
        Office.CommandBarControls rpControls = rpPopup.Controls;
        Office.CommandBarButton rpRight = rpControls[1] as Office.CommandBarButton;
        Office.CommandBarButton rpBottom = rpControls[2] as Office.CommandBarButton;
        Office.CommandBarButton rpOff = rpControls[3] as Office.CommandBarButton;
        if (rpOff.State == Office.MsoButtonState.msoButtonDown)
            previousState = ReadingPaneState.Off;
        if (rpBottom.State == Office.MsoButtonState.msoButtonDown)
            previousState = ReadingPaneState.Bottom;
        if (rpRight.State == Office.MsoButtonState.msoButtonDown)
            previousState = ReadingPaneState.Right;
        if (previousState != State)
        {
            switch (State)
            {
                case ReadingPaneState.Bottom:
                    rpBottom.Execute();
                    break;
                case ReadingPaneState.Off:
                    rpOff.Execute();
                    break;
                case ReadingPaneState.Right:
                    rpRight.Execute();
                    break;
            }
        }
        Marshal.ReleaseComObject(rpOff);
        Marshal.ReleaseComObject(rpBottom);
        Marshal.ReleaseComObject(rpRight);
        Marshal.ReleaseComObject(rpControls);
    }
    if (control != null) Marshal.ReleaseComObject(control);
    Marshal.ReleaseComObject(cmBars);
    Marshal.ReleaseComObject(explorer);
    return previousState;
}


Is it possible to place custom form on Preview Pane, replacing original?


Yes, just play with the ExplorerLayout property; try setting it to PreviewPane. However, you need to call the Activate method of ADXOlForm to replace the Preview pane programmatically.


Andrei Smolin
Add-in Express Team Leader
Posted 29 Apr, 2009 11:40:03 Top
Goran Vidic




Posts: 61
Joined: 2009-04-24
Thank you very much! I'll try this code!

Regards, Goran Vidic
Posted 29 Apr, 2009 12:19:46 Top