1

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

2

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, privacy policy and cookie policy

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