kamagra how much to take

Returning Site Directory SPList

Often times it is required to get a reference to the SPList that contains the site directory information, this is an important task when you are considering construction of navigation solutions or when building holistic reporting tools in order to support governance of site sprawl (which is easy to have happen, but sure is a PITA to get cleaned up!). In order to do this, you will use the Microsoft.SharePoint.SPListTemplateType enumeration to specify the type of a list definition or a list template, in this case the value 300 leveraging a direct cast. For example, a simple method to hydrate the coordinating SPList object can be done as such:

  1. public static SPList ReturnPortalSiteList(SPWeb web)
  2. {
  3. return web.Lists.Cast<SPList>().FirstOrDefault(list => Equals(list.BaseTemplate, (SPListTemplateType) 300));
  4. }

Easy as pie! :)



  1. Jeff Dalton says:

    Adam- Is it safe to return an SPList object using a static modifier?

  2. Adam Buenz says:


    I don’t see why not. All it is indicating is the method does not operate on the specific instance of the class and is callable without instantiating the class. I have a slightly adjusted of the above running in production code and haven’t seen any problems…Is there are particular thing you are concerned about?

  3. James R. says:

    Excellent. Exactly what I needed.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>