Explicitly ask for an interface after getting it from PropertyList
When the PropertyList is used from script code to get an interface, one must keep in mind that the default IDispatch interface is returned from such a request, and in some cases this means you will not get the interface you asked for. For example:
// The following line will get an IGrooveAccount interface var pIAccount = PropertyList.OpenProperty(PROPERTY_ACCOUNT);
// The following line will also get an IGrooveAccount interface, // but this is not what you would expect var pITelespaceProvider = PropertyList.OpenProperty(PROPERTY_TELESPACE_PROVIDER);
// This is the recommend way for both to make sure the expected // interface is returned var pIAccount = PropertyList.OpenProperty(PROPERTY_ACCOUNT).Account; var pITelespaceProvider = PropertyList.OpenProperty(PROPERTY_TELESPACE_PROVIDER).TelespaceProvider;
Use the "GrooveTelespace" object as reference to a tool's telespace
Starting with Groove v2.1, whenever you are using the free threaded version of the ScriptHost to write script code for your tool, you can now write code like:
var pITransaction = GrooveTelespace.OpenTransaction(true);
- instead of -
var pITelespace = PropertyList.OpenProperty(PROPERTY_TELESPACE).Telespace; var pITransaction = pITelespace.OpenTransaction(true);