Issue
Please, advise how I can get the Vault version and some other information from my code.
Solution
The Autodesk.Connectivity.WebServices.InformationService class is designed for this purpose. You may find useful this post about it in the Doug Redmond’s blog.
Ok, let’s show how to work with it in a short sample.
I will use my MyVaultServiceManager class from this post to connect to the server. It will let me to write the sample as simple like this:
// A sample how to work with the Vault InformationService
//=================================================================
class InfoServiceSample
{
// Show some information about the current Vault server
//===============================================================
public static void ShowServerInfo()
{
// Establish a connection to the server
using (MyVaultServiceManager mgr = new MyVaultServiceManager(
MyVaultServiceManager.Mode.ReadOnly))
{
try
{
// Print the server name
string svrInfo = "Server:\t"
+ mgr.Services.InformationService.GetServerName();
// Print all products available
Product[] PdSupported =
mgr.Services.InformationService.GetSupportedProducts();
svrInfo += "\nProduct List:"
+ "\n-------------------------------------------";
foreach (Product Pd in PdSupported)
{
svrInfo += "\n Product Name:\t\t " + Pd.ProductName
+ "\n Product Version:\t\t " + Pd.ProductVersion
+ "\n Product Display Name:\t " + Pd.DisplayName
+ "\n - - - - - - - - - - - - - - - - - - - - - - -";
}
MessageBox.Show(svrInfo, "Server Info");
}
catch (System.Exception err)
{
MessageBox.Show(err.ToString());
}
}
} // ShowServerInfo()
} // class InfoServiceSample
On my system this code produces the following result: