Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 !=
                 SPListTemplateType.DocumentLibrary
                 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
add comment

1 Answer 1

up vote 1 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
add comment

Your Answer

 
discard

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.