What format does HTMLDocument.script..GetType().InvokeMember return ?

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

What format does HTMLDocument.script..GetType().InvokeMember return ?
I'm trying to pass back JSON but I can unpack the return data 
George Kierstein




Posts: 47
Joined: 2013-05-04
Hi,

I'm returning JSON data from a script in a page and I can't see how to unpack the data. The InvokeMember method gets back a valid object but its a general COM class that doesn't have an obvious way to figure out what the data coming back from the script looks like or how to get it. There isn't anything that I could find in the documentation that makes this clear either.

My questions are: how in general do I figure out what types/kinds of data are passed back by InvokeMember, how do I get at them and specifically when I am passing back a JSON value what is its type and how do I get it into a form I can deserialize ?

Thanks
G
Posted 20 May, 2013 23:21:20 Top
Andrei Smolin


Add-in Express team


Posts: 19019
Joined: 2006-05-11
Hello George,

You can use Microsoft.VisualBasic.Information.TypeName(obj) to get the type name behind that COM object. You'll need to add a reference to Microsoft.VisualBasic.


Andrei Smolin
Add-in Express Team Leader
Posted 21 May, 2013 03:48:27 Top
George Kierstein




Posts: 47
Joined: 2013-05-04
Sorry, this is all in C# - Or is what you are referring to C# ?

Could you please provide a simple example of getting back a string please ?

Thanks!
Posted 21 May, 2013 04:12:14 Top
Andrei Smolin


Add-in Express team


Posts: 19019
Joined: 2006-05-11
This syntax is valid in C# and VB.NET:

System.Diagnostics.Debug.WriteLine(Microsoft.VisualBasic.Information.TypeName(obj)).

For this code to compile and execute, the project needs to have a reference to Microsoft.VisualBasic.DLL. To get the output of the Debug.WriteLine() method, you can use the DebugView utility; IE should be run either via "Run as administrator" or with Protection Mode turned off; the add-on must be built in the Debug configuration.


Andrei Smolin
Add-in Express Team Leader
Posted 21 May, 2013 04:46:46 Top