SPSite siteCollection = new SPSite("Http://Mohan");
SPWebCollection sites = siteCollection.AllWebs;
foreach (SPWeb site in sites)
{
//SPListCollection:- object that represents the collection of lists in a site
SPListCollection lists = site.Lists;
foreach (SPList list in lists)
{
if (list.BaseType == SPBaseType.DocumentLibrary)
{
//SPDocumentLibrary:- Represents a document library in Windows SharePoint Services. displays the name of the site and list, as well as the file name, for each item in every document library.
SPDocumentLibrary docLibrary = (SPDocumentLibrary)list;
if (!docLibrary.IsCatalog && list.BaseTemplate != SPListTemplateType.XMLForm)
{
//SPListItemCollection :- Represents a collection of SPListItem objects. To return the collection of items for a list or document library
SPListItemCollection docLibItems = docLibrary.Items;
foreach (SPListItem docLibItem in docLibItems)
{
Label1.Text += docLibItem.Name + "<br>";
//Label1.Text += " Docuement title -- " + docLibItem["Title"] + "<BR>";
}
}
}
}
}
SPWebCollection sites = siteCollection.AllWebs;
foreach (SPWeb site in sites)
{
//SPListCollection:- object that represents the collection of lists in a site
SPListCollection lists = site.Lists;
foreach (SPList list in lists)
{
if (list.BaseType == SPBaseType.DocumentLibrary)
{
//SPDocumentLibrary:- Represents a document library in Windows SharePoint Services. displays the name of the site and list, as well as the file name, for each item in every document library.
SPDocumentLibrary docLibrary = (SPDocumentLibrary)list;
if (!docLibrary.IsCatalog && list.BaseTemplate != SPListTemplateType.XMLForm)
{
//SPListItemCollection :- Represents a collection of SPListItem objects. To return the collection of items for a list or document library
SPListItemCollection docLibItems = docLibrary.Items;
foreach (SPListItem docLibItem in docLibItems)
{
Label1.Text += docLibItem.Name + "<br>";
//Label1.Text += " Docuement title -- " + docLibItem["Title"] + "<BR>";
}
}
}
}
}
No comments:
Post a Comment