Diff B/w SPSite & SPWeb
SPSite class:
- SPSite Represents a collection of sites on a virtual server, including a top-level site and all its subsites.
- Each SPSite object, or site collection, is represented within an SPSiteCollection object that consists of the collection of all site collections on the virtual server.
- SPSite.OpenWeb Method: Returns the site that is located
at the specified server-relative or site-relative URL.
SPWeb Simply represents Windows SharePoint Services Web site.
Code sample to create a site:
SPSite mySite = new SPSite("http://servername/");SPWeb myWeb = mySite.AllWebs["Site_Name"];
SPWeb myRootWeb = mySite.RootWeb;
Note:
- SPSite and SPWeb inherit directly from System.Object
- Calling Dispose ensures all resources used by those objects are immediately released.
Comments
Post a Comment