Difference Between 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 anSPSiteCollection 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 class :
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.

SHARE THE KNOWLEDGE


  

Advertisements

About Dinesh

I am engineering student........ I am selected in Microsoft Student Partner as MSP............

Posted on October 20, 2011, in Internet, Knowledge. Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: