All configurations, i.e., for build-in views, extension views, features, etc. in SystemWeaver have a guid. This articles describes how to use the API to get and set SystemWeaver XML configurations.
Note: This does not apply to Config Items, i.e., XML definitions for reports, grids, graphs, charts, etc. |
How to Get All XML Configurations
static void Main(string[] args) { SWConnection.Instance.ServerMachineName = "localhost"; SWConnection.Instance.ServerPort = 1768; SWConnection.Instance.LoginName = "admin"; SWConnection.Instance.Password = "supersecurepassword"; SWConnection.Instance.Login(); //This is the guid of SWExplorer itself. const string swExplorerConfigGuidString = "{66E59E81-2EA6-478E-B650-2A222A559B98}"; var swExplorerConfigGuid = Guid.Parse(swExplorerConfigGuidString); var swExplorerConfig = SWConnection.Instance.Broker.GetApplicationConfig(swExplorerConfigGuid); var configGuids = swExplorerConfig.GetAllGuids(); foreach (var guid in configGuids) { Console.WriteLine($"-------{guid.ToString()}"); Console.WriteLine(swExplorerConfig.ConfigXML(guid)); } Console.ReadKey(); }
How to Get and Set an XML Configuration
static void Main() { SWConnection.Instance.ServerMachineName = "localhost"; SWConnection.Instance.ServerPort = 1768; SWConnection.Instance.LoginName = "admin"; SWConnection.Instance.Password = "supersecurepassword"; SWConnection.Instance.Login(); //This is the guid of swExplorer itself. const string swExplorerConfigGuidString = "{66E59E81-2EA6-478E-B650-2A222A559B98}"; var swExplorerConfigGuid = Guid.Parse(swExplorerConfigGuidString); var swExplorerConfig = SWConnection.Instance.Broker.GetApplicationConfig(swExplorerConfigGuid); //The guid of the config that you want to change. In this case, it's an extension guid. var extensionConfigGuid = Guid.Parse("{F44F7994-20EC-4193-B02D-30BD8A6DA11B}"); //Get the config XML Console.WriteLine("Original config: " + Environment.NewLine + swExplorerConfig.ConfigXML(extensionConfigGuid)); //Set the config XML swExplorerConfig.SetConfigXML(extensionConfigGuid, "<Test/>"); //Get the config XML again to verify the change Console.WriteLine("Changed config: " + Environment.NewLine + swExplorerConfig.ConfigXML(extensionConfigGuid)); Console.ReadKey(); }
Example
The Guid for views and extension views in Configure the explorer can be seen on the Item views tab.