I have created list (say List1) on Central Administration Site. I would like to read the title value from that list programmatically. How can I do it? I don't want to hard code the URL of central administration site.

Also, in my code I have SPWebApplication object of Central Admin .Let me know if I can use it .


You can use your web application object in the function like below :

private string GetListTitle(SPWebApplication webApp)
        //To ensure if your web application object hosts central admin
        if (webApp.IsAdministrationWebApplication)
            SPList list = webApp.Sites[0].RootWeb.Lists["List1"];
            return list.Title;
        return string.Empty;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.