Showing posts with label Sharepoint website. Show all posts
Showing posts with label Sharepoint website. Show all posts

Tuesday, March 30, 2010

Sharepoint Website Collection.



Listing all the websites from the share point site and its owner.

SPSite site = new SPSite("http://localhost");
SPWeb web=site.AllWebs;
foreach(SPWeb web in collection)
{
DropDownList1.Items.Add(web.Author.ToString());
}


Listing all lists in the website
SPSite site = new SPSite("http://localhost/SiteDirectory/IT"); //IT-site name
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Posts"]; // a List in the site
foreach(SPListItem col in list.Items)
{
DropDownList2.Items.Add(col.Title.ToString()); // Item in the List
}