Genesys CTI User Forum > Genesys-related Development

Trying to read from CME >Application>options in.Net

<< < (2/2)

Vegeta:
Thanks Kubig and Daniel San for your responses.

cavagnaro:
[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]

PeteHoyle:
Yes, just for WDE.

cavagnaro:
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?

Navigation

[0] Message Index

[*] Previous page

Go to full version