.NET AddIn Question UserControl in Folder homepage
Have you tried passing the COMAddIn object from the jscript to the
UserControl (i.e. add another parameter to the Initialize method that
accepts the object)? Just a thought, you'll probably hit the same barrier
you're hitting now but maybe you'll get a useful exception. Also, at this
point
addins = olapp.COMAddIns
can you get a value for addins.Count? If not does it throw an exception? If
it does, can you iterate through the collection?
"David Ing" wrote in message
...
Thanks for the reply Dave.
I have tried the moral equivalent of the jscript in .NET, but it seems to
come down the following problems:
- When I get back the AddIns collection from within .NET, i.e. with this:
Dim o As Microsoft.Office.Core.COMAddIn
Dim addins As Microsoft.Office.Core.COMAddIns
addins = olapp.COMAddIns
o = addins.Item("TheRightProgId")
..then the COMAddIn.Item.Object is alway 'null'.
- I know that I can access the object because the jscript (the one that
actually launchs the .NET UserControl) works fine, i.e. can use the
COMAddIn
.Object just fine.
Also, to be clear, I need info/funcitonality from my AddIn, not just
general
Outlook info.
More Background, in case it's useful:
- This is a .NET 1.1 Shimmed Outlook Add-in written in C#
- Using Outlook 2003 (although I need it to work for more than just 2003,
which is why I didn't go the VSTO2005 route).
- If I write a stand-alone VB.NET app that get's a new _app, i.e. outside
the AddIn Outlook.ApplicationClass, then the COMAddIn.Object are always
'null' too, even though they 'run' and are shown '.Connected=true'
Any help, ideas etc most appreciated...
"Dave Kane [MVP - Outlook]" wrote:
I haven't tried this but I assume that you already tried the equivalent
of
your in-page jscript and that didn't work. You can get to an add-in in
the
running Outlook session from IE hosted in a FHP, but a standalone browser
has different security barriers. Perhaps your UserControl, even though
it's
hosted in the FHP, is hitting those barriers. Do you need to reach the
add-in instance that Outlook loaded on startup, or just access Outlook
data?
"David Ing" wrote in message
...
Hello,
I have a .NET winforms UserControl hosted inside a HTML page which is
referenced as a Outlook Folder Home Page. (Kind of like the recent MSFT
CRM
Integration example)
The .NET UserControl is initialized by using the following bit of
jscript
in
the HTML:
var oApp = window.external.OutlookApplication;
SomeControl.Initialize(oApp);
So what I need some info around is this: How do I, from my .NET
UserControl,
gain access back into my .NET Outlook Add-in instance?
Paraphrased, I need to be able to call .NET functions from my
UserControl
(the one hosted in the HTML page) back into the Outlook-Addin.
In jscript, in the same HTML page, I can reference the Add-In using the
COMAddIns enumeration, i.e (roughly):
var addin = app.COMAddIns.Item("MyAddIn.Connect");
var h = addin.Object;
h.AdotNetFunctionInMyAddIn("hello")
But how would I do this from within my .NET UserControl in C#?
Any help, clues, ideas appreciated. Thanks!
David
|