Genesys CTI User Forum > Genesys-related Development

Updating the Options of genesys application using Genesys SDK

<< < (2/2)

PeteHoyle:
Hi,

Here is some sample code that demonstrates how to update the option of an application using the COM Application Block, you just add error handling etc..:

[code]                var applicQuery = new CfgApplicationQuery { Name = "InteractionWorkspace_ATOS" };
                CfgApplication application = confService.RetrieveObject<CfgApplication>(applicQuery);

                Console.WriteLine(application.Name);
                KeyValueCollection kvcOptions = application.Options;

                if (kvcOptions != null)
                {
                    //Check for Section called 'Test'
                    if (kvcOptions.ContainsKey("Test"))
                    {
                        KeyValueCollection test = kvcOptions.GetAsKeyValueCollection("Test");
                        if (test != null)
                        {
                            //Check for Option called 'Option1'
                            if (test.ContainsKey("Option1"))
                            {
                                //Set new value if we have it
                                test["Option1"] = DateTime.UtcNow.ToString();
                            }
                            else
                            {
                                //Add it if we don't
                                test.Add("Option1", DateTime.UtcNow.ToString());
                            }
                        }
                       
                    }
                    else
                    {
                        //Create enw section called 'Test' and add option called 'Option1'.
                        KeyValueCollection Option1 = new KeyValueCollection();
                        Option1.Add("Option1", DateTime.UtcNow.ToString());
                        kvcOptions.Add("Test", Option1);
                    }
                }
                application.Save();[/code]

genesyslearner:
Thanks PeteHole. the code helped me through to update the options field.

Navigation

[0] Message Index

[*] Previous page

Go to full version