C# Programming
09-17-2009, 01:16 AM
Hi,
I am writing an outlook Addin which shows a panel on the explorer window of Outlook.
The Panel shows some details regarding the sender of the Email. My user control "TaskPaneControl" has a panel along with some other controls. My code is as below.
Microsoft.Office.Tools.CustomTaskPane taskPane;
Microsoft.Office.Interop.Outlook.Application applicationObject;
Outlook.Explorer explorer;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
explorer = this.Application.ActiveExplorer();
explorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(activeExplorer_SelectionChange);
}
void activeExplorer_SelectionChange()
{
if (taskPane == null)
{
taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(
new TaskPaneControl(), "Sender Details", explorer);
taskPane.Visible = true;
taskPane.Width = 245;
return;
}
if (taskPane != null)
{
Microsoft.Office.Interop.Outlook.Selection selection = explorer.Selection;
if (selection.Count == 1 && selection[1] is Microsoft.Office.Interop.Outlook.MailItem)
{
Microsoft.Office.Interop.Outlook.MailItem mailitem = (Microsoft.Office.Interop.Outlook.MailItem)selection[1];
TaskPaneControl ct = new TaskPaneControl();
ct.ShowEmailDetails(mailitem);
}
}
}
The problem here is, on change of Email in the inbox, activeExplorer_SelectionChange method gets executed but the taskpane will not be *******ed.
Please let me know how to ******* the Task pane Contol.
Thanks in advance.
I am writing an outlook Addin which shows a panel on the explorer window of Outlook.
The Panel shows some details regarding the sender of the Email. My user control "TaskPaneControl" has a panel along with some other controls. My code is as below.
Microsoft.Office.Tools.CustomTaskPane taskPane;
Microsoft.Office.Interop.Outlook.Application applicationObject;
Outlook.Explorer explorer;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
explorer = this.Application.ActiveExplorer();
explorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(activeExplorer_SelectionChange);
}
void activeExplorer_SelectionChange()
{
if (taskPane == null)
{
taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(
new TaskPaneControl(), "Sender Details", explorer);
taskPane.Visible = true;
taskPane.Width = 245;
return;
}
if (taskPane != null)
{
Microsoft.Office.Interop.Outlook.Selection selection = explorer.Selection;
if (selection.Count == 1 && selection[1] is Microsoft.Office.Interop.Outlook.MailItem)
{
Microsoft.Office.Interop.Outlook.MailItem mailitem = (Microsoft.Office.Interop.Outlook.MailItem)selection[1];
TaskPaneControl ct = new TaskPaneControl();
ct.ShowEmailDetails(mailitem);
}
}
}
The problem here is, on change of Email in the inbox, activeExplorer_SelectionChange method gets executed but the taskpane will not be *******ed.
Please let me know how to ******* the Task pane Contol.
Thanks in advance.