Freigeben über


Using LINQ to retrieve list of external lists in current web

Body:

This one is a short little post, I was looking for a way to use LINQ to query list of external lists created in current web, I didn’t want to enumerate through list collection and check the base template. See the code sample below.

Cheers,

</Ram>

 var lists = (from el in web.Lists.OfType<SPList>()
             where el.BaseTemplate == SPListTemplateType.ExternalList
            select el);

 

Technorati Tags: SharePoint2010,Code Samples

Published: 10/9/2011 9:51 AM