cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
546
Views
0
Helpful
2
Replies

InstalledLanguage - why no static GetInstalledLanguages?

stephan.steiner
Spotlight
Spotlight

I need to get a list of installed languages from CUPI. No problem - InstalledLanguage myLang = new InstalledLanguage();

But.. if we take UserBase as an example, there's a UserBase.GetUser that takes a connectionserverrest and returns a UserBase as out variables.

So I propose the following change to InstalledLanguages: Add a new static method that extracts the installed languages the same way other objects allow extraction and return a WebCallResult:

        public static WebCallResult GetInstalledLanguages(out List<InstalledLanguage> languages, ConnectionServerRest pConnectionServer)

        {

            WebCallResult res = new WebCallResult();

            res.Success = false;

            languages = null;

            if (pConnectionServer == null)

            {

                res.ErrorText = "Null Connection server object passed to GetInstalledLanguages";

                return res;

            }

            InstalledLanguage lang = null;

            try

            {

                lang = new InstalledLanguage(pConnectionServer);

                languages = lang.InstalledLanguages;

                res.Success = true;

            }

            catch (UnityConnectionRestException ex)

            {

                return ex.WebCallResult;

            }

            catch (Exception ex)

            {

                res.ErrorText = "Failed to fetch languages in GetInstalledLanguages:" + ex.Message;

                return res;

            }

            return res;

        }

That way, you can use the same mechanism to extract installed languages as other things.

Would you consider adding this to InstalledLanguages?

Thanks

Stephan

Message was edited by: Stephan Steiner, added a sample implementation of what I'm looking for

2 Replies 2

jocreed
Cisco Employee
Cisco Employee

Stephan, I will submit this up as a feature enhancement and will post the bug ID here when I have completed it.

Actually, it's a feature request for Jeff's CUPI.NET lib. I hope he's on a well deserved holiday and I didn't scare him off with my ever outrageous requests.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: