Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: Vegeta on June 22, 2016, 12:52:00 PM
-
Hi Genesys Wizards,
I am trying to read the values from CME servers Application -> Properties -> Options (via .Net PSDK API)
I am trying to read it manually like Configuration>environment>applications>Desktop ( Right click on listed application Name>properties>options).
if its the cfgapplication object , then I am looking at a method called getoptions() to probably achieve the same in JAVA
URL :http://www.genesyslab.info/repository/PSDK/8.0-Java_API_Reference/com/genesyslab/platform/applicationblocks/com/objects/CfgApplication.html#getOptions()
But I don't see a similar method listed in .Net PSDK chm file :(
So I tried to do it like the below in .net as a first step I was trying to read the application Name but no luck. (then I would want to read the options )
Could you please advice if am missing anything or is there a equivalent method like getoptions in .net?
[code]
var CfgapplicQuery = new CfgApplicationQuery(service) { Name = "MY APPLIC NAME"};
var CfgApplication_Query_Values = CfgapplicQuery.Execute();
foreach (CfgApplication values in CfgApplication_Query_values)
{
MessageBox.Show(Values.Name); // I would expect it to display the Applic Name passed in query while it isn't!!
}
[/code]
-
You have to work with CfgApplication object to allow using method getOptions(). Did you try to retype the retrieved object to the CfgApplication?
-
That code works for me..
In .Net to get the options use .Options
[code]var CfgapplicQuery = new CfgApplicationQuery(confService) { Name = "Stat_Server" };
var CfgApplication_Query_Values = CfgapplicQuery.Execute();
foreach (CfgApplication values in CfgApplication_Query_Values)
{
Console.WriteLine(values.Name);
var kvLog = values.Options["Log"];
if (kvLog != null)
{
}
}[/code]
-
Another way to do the same...
CfgApplication app = configService.MyApplication;
And then, app.UserProperties (annex) , appOptions (options)
Regards!
-
[quote author=PeteHoyle link=topic=9681.msg43811#msg43811 date=1466664655]
That code works for me..
In .Net to get the options use .Options
[code]var CfgapplicQuery = new CfgApplicationQuery(confService) { Name = "Stat_Server" };
var CfgApplication_Query_Values = CfgapplicQuery.Execute();
foreach (CfgApplication values in CfgApplication_Query_Values)
{
Console.WriteLine(values.Name);
var kvLog = values.Options["Log"];
if (kvLog != null)
{
}
}[/code]
[/quote]
Thanks PeteHoyle :) with your code I got some idea how to do this .. :)
-
Thanks Kubig and Daniel San for your responses.
-
[quote author=daniel_san link=topic=9681.msg43821#msg43821 date=1466751922]
Another way to do the same...
CfgApplication app = configService.MyApplication;
And then, app.UserProperties (annex) , appOptions (options)
Regards!
[/quote]
Need a clarification here...this code would be for WDE, right? [color=rgb(51, 51, 51)][font=Arial][size=13px]IConfigurationService?[/size][/font][/color]
-
Yes, just for WDE.
-
I have made the following code to read options from an app (URS option has URI and other values)
APP
|__> URL1
|__>URI: [url=http://www.yahoo.com]http://www.yahoo.com[/url]
|__>q=123456
[code]
IConfService confService = ConfServiceFactory.CreateConfService(p);
CfgApplicationQuery cfgapp = new CfgApplicationQuery(confService) { Name = "SampleAPP" };
//var cfgApp_Values = cfgapp.Execute();
//foreach (CfgApplication values in cfgApp_Values)
//{
// Console.WriteLine(values.Name);
// writeToLogArea("Option values: " + values.Name);
//}
CfgApplication app = confService.RetrieveObject<CfgApplication>(cfgapp);
KeyValueCollection kvp1 = new KeyValueCollection(app.Options);
writeToLogArea("SampleAPP Options: " + kvp1.ToString());
//kvp1.GetAsKeyValueCollection("URL1");
foreach (DictionaryEntry x in kvp1)
{
if (x.Key.ToString().StartsWith("URL")) {
writeToLogArea("URL Section >" + x.Key + ":" + x.Value);
KeyValueCollection values = new KeyValueCollection();
values = kvp1.GetAsKeyValueCollection(x.Key.ToString());
foreach(DictionaryEntry val in values)
{
writeToLogArea("URL Parameters > " + val.Key + ":" + val.Value);
if(val.Key.ToString().StartsWith("URI"))
writeToLogArea("URI for " + x.Key + " is " + val.Value.ToString());
}
}
}
[/code]
What do you think? Works for me but wondering if there is a more effective way?