ADXRemoteAgain

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

ADXRemoteAgain
ChannelSink required ? 
Robert Boulanger




Posts: 4
Joined: 2006-10-31
When I try exactly what was described in

this Forum

I get the following Error Message as soon as I try to call GetPrperty or CallMethod:

This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.

The only difference to the other topics in here regarding ADXRemoteObject is, that I try to call a Method of a Word Addin from an Outlook Addin, both created with ADX in VS2005.

So my questions are:

1.) why does this not work from .NET ?
2.) Is there a better way to for letting talk two different Addins in two different Office Apps with eachother ?

Any help appreciated

-Robert

Posted 31 Oct, 2006 08:02:35 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Robert.

If you call add-in from the .NET code, you should use the AddinExpress.MSO.ADXAddinModule.GetProxyProperty,
AddinExpress.MSO.ADXAddinModule.CallProxyMethod,
AddinExpress.MSO.ADXAddinModule.SetProxyProperty static methods instead of the methods mentioned in the topic.
Please look at the OutlookPropertyPage example from the ADX installation package to learn how it works.
Posted 31 Oct, 2006 09:36:09 Top
Robert Boulanger




Posts: 4
Joined: 2006-10-31
Hi Sergey,

thanks for your fast reply.


Please look at the OutlookPropertyPage example from the ADX installation package to learn how it works.


I adapted the sample for my needs but already here:


string progID = (string)AddinExpress.MSO.ADXAddinModule.                                    CallProxyMethod(addinObj.Object, "GetProgID", null);


I get an Error which says


"Exception has been thrown by the target of an invocation."


the same error occurs when I try to get the RemoteObject via

addinmodule=Word.COMAddIns.Items("progid here").object

and afterwards

AddinExpress.MSO.ADXAddinModule.GetProxyProperty(addinModule, "a")

or

AddinExpress.MSO.ADXAddinModule.GetProxyProperty(addinModule, "a",null)


Any ideas ?

--Robert
Posted 31 Oct, 2006 10:55:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Robert.

Did you test the example? Did it work on your PC?
If so, please add a button to the PropertyPage1 class in the example and test the following code:

private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show(AddinExpress.MSO.ADXAddinModule.CallProxyMethod(addinModule, "GetProgID", null).ToString());
}

I tested it on my PC. It should work properly.
Posted 01 Nov, 2006 07:47:28 Top
Robert Boulanger




Posts: 4
Joined: 2006-10-31
Hey Sergey,

I did what you suggested, and it works, but in meanwhile I examined the Details of the Exception thrown in my Application, and the InnerException is the same as in Message 1 here.

This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.


While the OutlookPropertyPage Sample is working well, I now think that my Error here is caused because I try to invoke methods of a physically complete different Add-In in a different Office App. (Remember, I'm calling a Word Add-in from an Outlook Add-in).

Maybe the technique used in the OutlookPropertyPage Example works only if trying to call a Method in the same Addin, not if the target is a different on in a different Application.

On the other hand, I can't imagine that nobody tried before to develop Office Addins which are able to communicate with each other.

So I wonder now, whether I might have luck if a try to develop an Outlook Addin which a sub Addin module which registers in Word and try then to invoke a method from where the caller is the outlook Addin Module and the target is located in the Word Addinmodule.

Will I need to add a seperate Shim for the SubModule which is Word only ?

-Robert
Posted 01 Nov, 2006 07:55:49 Top
Robert Boulanger




Posts: 4
Joined: 2006-10-31
Hey Sergey,

I was able to reduce the whole thing to an reproducable project:

Just create an Addin which registers for word and outlook.
Add a property (here its called "a") which is the method we want to invoke.


public string ab;
public string a
{
 get
 {
  return "Hello From MainModule";
 }
 set
 {
  ab = value;
 }
}


Then we have two calling methods (here in buttons):

private void AdxCmdWord_Click(object sender)
{
 Word = new Microsoft.Office.Interop.Word.Application();
 string ProgId = "";
		  Word.Dialogs(Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFileNew).Show();
 Word.ActiveDocument.Activate();
 Word.ActiveWindow.Visible = true;
 Word.ActiveWindow.Activate();
 object am = FindAddinModule(Word, "OutlookAddinShim.Proxy");
 string text = AddinExpress.MSO.ADXAddinModule.GetProxyProperty(am, "a");
 AddinExpress.MSO.ADXAddinModule.SetProxyProperty(am, "a", "back");
}
private void AdxCmdOutlook_Click(object sender)
{
 object am = FindAddinModule(OutlookApp, "OutlookAddinShim.Proxy");
 string text = AddinExpress.MSO.ADXAddinModule.GetProxyProperty(am, "a");
 AddinExpress.MSO.ADXAddinModule.SetProxyProperty(am, "a", "zurück");
}


So when you now execute the "AdxCmdOutlook_Click" All is working fine.
If you invoke the "AdxCmdWord_Click" you will get the error described in the messages above. (FYI: I changed the FindAddinModule Method to a function which allows me to be more dynamic, but it's the same thing like in the OutlookPropertyPage Example.)

So for me it seems that it is not possible to invoke a method of an AddIn, if the HostApplication is different, even if the Addin is the same.

Could you confirm that ?

--Robert
Posted 01 Nov, 2006 08:57:13 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Robert,
please send me the code. I will test it on my PC.
Posted 01 Nov, 2006 09:17:05 Top