SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|improve this question
up vote 2 down vote accepted

You need to filter out hidden lists:

var lists = web.Lists.OfType<SPList>().Where(l => l.Hidden == false && l.BaseTemplate != SPListTemplateType.DocumentLibrary).ToList();
share|improve this answer
Thanks a lot Alex... – DeathRider Feb 13 '12 at 9:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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