Sunday, March 01, 2009

How to List Document Librarys

Hello,

You problably ask "how do i only list Document librarys?"

There are Methods will get the type of list we want to filter 
SPBaseType
SPListTemplateType

Here a litle example of how to get Document librarys
using( Spsite site = SPContext.Current.Site)
{
using(SPWeb Web = site.OpenWeb())
{
                foreach (SPList List in Web.Lists)
                {
                    if (List.BaseType == SPBaseType.DocumentLibrary && List.BaseTemplate == SPListTemplateType.DocumentLibrary)
                    {
 response.write(List.Title+"
");

                    }
                }
}
}
Post a Comment