|
Matt Driver
Matt
Posts: 152
Joined: 2004-08-17
|
Hi
The other day I got the Outlook page integrated with the main addin via the remoting/monitor advanced example that ADX supply. This was all fine.
Today I have rebuild the project under the very latest build of ADX and have come across an odd issue.
When the ADX is initialized the following runs:
this.SupportedApps = ((AddinExpress.MSO.ADXOfficeHostApp)((AddinExpress.MSO.ADXOfficeHostApp.ohaWord | AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook)));
This shows both Word and Outlook as supported apss. When the following code then runs on the Options page intialize as per example:
CreateBindCtx(0, out uCOMIBindCtx);
uCOMIMonikers[0].GetDisplayName(uCOMIBindCtx, null, out str);
if (str.ToUpper() == guid.ToUpper())
{
uCOMIRunningObjectTable.GetObject(uCOMIMonikers[0], out local);
outlookApp = (Microsoft.Office.Interop.Outlook.Application)local;
break;
}
The return type of local is:
Microsoft.Office.Interop.Word.ApplicationClass and not Outlook.Application class I then get a cast exception on the next line.
Before I rebuild my project I was getting the outlook app type returned but am now getting Word type, any ideas ?
I have turned off Word as a supported App and removed AdxWordEvetnts from the project retested and it works fine. I wanted to support word as I want to do things with word as e-mail editor events.
Any ideas how to get this working with Word Supported ?
thx
Matt |
|
Posted 07 Jun, 2006 07:39:32
|
|
Top
|
|
Matt Driver
Matt
Posts: 152
Joined: 2004-08-17
|
Hi
I take the last bit back it still fails even with turned off Word as a supported App and removed AdxWordEvetnts from the project |
|
Posted 07 Jun, 2006 07:42:55
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Matt.
Do you use the code below when the add-in starts in Outlook only?
private void AddinModule_AddinStartupComplete(object sender, System.EventArgs e)
{
Guid g = this.GetType().GUID;
RegisterActiveObject(Marshal.GetIUnknownForObject(HostApplication), ref g, ACTIVEOBJECT_WEAK, ref objectHandle);
} |
|
Posted 07 Jun, 2006 08:13:04
|
|
Top
|
|
Matt Driver
Matt
Posts: 152
Joined: 2004-08-17
|
Hi
I have:
private void AddinModule_AddinStartupComplete(object sender, System.EventArgs e)
{
try
{
Guid g = this.GetType().GUID;
RegisterActiveObject(Marshal.GetIUnknownForObject(HostApplication), ref g, ACTIVEOBJECT_WEAK, ref objectHandle);
RegistryAccess.Disable_Pivotal_Outlook_Mail_Integration();
//Initialise Toolbars
InitExplorer();
InitInspector();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error loading Pivotal Outlook Mail Integration, Please contact pivotal Support with this error message: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
|
|
Posted 07 Jun, 2006 08:57:55
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Try to change the code as shown below:
private void AddinModule_AddinStartupComplete(object sender, System.EventArgs e)
{
if (HostType == AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook)
{
Guid g = this.GetType().GUID;
RegisterActiveObject(Marshal.GetIUnknownForObject(HostApplication), ref g, ACTIVEOBJECT_WEAK, ref objectHandle);
}
}
|
|
Posted 07 Jun, 2006 12:09:36
|
|
Top
|
|
Matt Driver
Matt
Posts: 152
Joined: 2004-08-17
|
For some reason today after a reboot and a tidy up the old code is now reporting the correct type. I have used you example though so all is working.
Thanks
Matt |
|
Posted 08 Jun, 2006 10:05:56
|
|
Top
|
|