Basically you need to use the PDSK to connect to the configuration layer (confserv or a proxy), read the application object and then iterate through the flexible and user attribute properties.
But when I did it, ConfServer returns me list of all folders. My request works properly when I set key on name and search phrase f.e. “Business Attributes”
But how can I find values from 1TestPFR? Maybe I try to find unapropriate objectType? Unfortunately, any of available Layer objects not fit directly. Have you any idea, how to handle with this?
//Retrive object from ConfServer (I knew ID of it)
IConfService confService = ConfServiceFactory.CreateConfService(protocol);
ICfgObject cfgObject = confService.RetrieveObject(1304, CfgObjectType.CFGEnumerator);
//Get values from retrieved object
CfgEnumeratorValueQuery qqq2 = new CfgEnumeratorValueQuery(confService)
{
EnumeratorDbid = qq2.DBID
};
var qqqq = qqq2.Execute();
foreach(var g in qqqq)
{
Debug.WriteLine("**** " + g.Name);
Debug.WriteLine("**** " + g.ObjectPath);
}
protocol.Close();</blockquote>
if you are using Interaction Workspace application then the application already creating a connection to Configuration server or configuration proxy to get all its data you can use it like below instead of reopening new connection (consume more resources) and deal with the headache of managing connection disconnection issues.
In module initialization you can use:
readonly IConfigurationService configService;
public XXXXExtensionModule(IObjectContainer container, IViewManager viewManagerObject, IChannelManager channelManager, IConfigurationService configService, IAgent agentObject)
{
this.container = container; this.configService = configService;
this.channelManager = channelManager;
agent = agentObject;
viewManager = viewManagerObject;
wdeApp = configService.RetrieveObject(new CfgApplicationQuery() { Name = configService.ApplicationName });
this.log = container.Resolve().CreateChildLogger(“Initialization”);
staticLog = container.Resolve().CreateChildLogger(“Initialization”);
}
And here is one of my favorite functions that try to retrieve value from agent/agent group/application then tenant until it is found
//////////////////////////////////////////////////////
// Retrieve option from different configuration levels
public static string retrieveOption(string optionName, string section)
{
// Checking agent for the option
if (agent.ConfPerson.UserProperties.ContainsKey(section) && agent.ConfPerson.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.ConfPerson.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
// Checking Agent groups for the option
for (int i = 0; agent.AgentGroupsForAgent.Count > i; i++)
{
if (agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.ContainsKey(section) && agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
}
// Checking WDE application for the option
if (wdeApp.Options.ContainsKey(section) && wdeApp.Options.GetAsKeyValueCollection(section).ContainsKey(optionName))
return wdeApp.Options.GetAsKeyValueCollection(section).GetAsString(optionName);
// Checking Tenant for the option
else if (agent.Tenant.UserProperties.ContainsKey(section) && agent.Tenant.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.Tenant.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
else
return null;
}
}