How can I get only the lists present in a particular site? I've tried the following one:

var listNames = from SPList list in web.Lists
                 where list.BaseTemplate !=
                 select list.Title;

But it also shows the workflow history,web part gallery etc. which are not required.How can I get rid of this problem? Waiting eagerly for your answers...

1 Answer 1


You need to filter out hidden lists:

var lists = web.Lists.OfType<SPList>().Where(l => l.Hidden == false && l.BaseTemplate != SPListTemplateType.DocumentLibrary).ToList();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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