in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

This Blog

Syndication

ChadClarkesMOSSBlog

Discussion: Site versus Web in MOSS 2007

I would like to open this discussion up because I'm having trouble differentiating the terms.  Especially when dealing with the object model.  SPSite vs. SPWeb.  Are there any known differences?  My latest thoughts have been that SPSite is the top level site for a site collection and SPWeb can be a site within that site collection...  But very unsure here.  Please comment!

Comments

 

Robin said:

You are right..

SPSite = sitecollection

SPWeb = site within a sitecollection, thus can also be subsite of a site.

September 7, 2007 11:10 AM
 

ChadClarke said:

But then SPWeb can have subsites as well correct?  Can SPSite have a parent site?

September 7, 2007 11:28 AM
 

Waldek Mastykarz said:

It's much easier if you take the SDK as the beginning point: SPSite (Site Collection) may contain other webs (but not other Site Collections). If you go further you see there is this SPSite.RootWeb property - it's the website you see when you type your Site Collection's URL. Site Collection is quite abstract: you cannot see it inspite of using it's URL: all you get to see is the RootWeb. Then there are the Webs (called Sites by Microsoft: so Site Collection contains Sites) - SPWeb in the SDK. Webs can contain other Webs.

Site Collection is the beginning point of your hierarchy tree: there is nothing about it you could see through the GUI. If you use the SharePoint Manager you will run into Web Application (IIS Virtual Server): a Web Application may contain multiple Site Collections, so:

1. Web Application

1.1 Site Collection (SPSite)

1.1.1 Site (SPWeb)

1.1.2 Site (SPWeb)

1.2 Site Collection (SPSite)

1.2.1 Site (SPWeb)

1.2.1.1 SubSite (SPWeb)

1.2.1.2 SubSite (SPWeb)

Hope it's clear now.

September 8, 2007 6:51 AM
 

ChadClarke said:

Reading the SDK, who woulda thunk it.  Well, that is some great information.  THANKS!

September 10, 2007 11:33 AM
 

Doug said:

Think of a site collection as a container and boundary for features and permissions.

You would create a site collection under an existing site collection instead of creating a subsite if you wanted to maintain a heirarchy with the url, but wanted a different site collection administrator and default set of permisions and/or a different set of site collection features (master pages, site columns, etc..).

Remember that all of the elements of a site collection, sites, lists, and document libraries, by default inherit their permissions from the site collection.

HTH...

September 18, 2007 1:10 PM
 

ChadClarke said:

Well, from my understand of MOSS 2007, you have a web application on the server, then you have site collections on the web application, then you have sites on the site collections, and then you subsites to the sites or even subsites to the subsites.  In which case SPSite is the class for site collections and SPWeb is the class for sites and subsites.  I don't believe that you can create a site collection within another site collection but you can daisy chain subsites within a site collection...  This is as far as the object model goes and if you need to do any programming against it.  SPSite does contain information such as the url which would be the same as the url for the root web, but to get to the site(SPWeb) you need to use SPSite.rootweb.  As far as security and features, I believe that would be a good discussion topic.

September 19, 2007 8:29 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts