Content Hierarchy of SharePoint Foundation
Published: May 2010
The Microsoft SharePoint Foundation object model can be usefully divided into three hierarchies. This topic discusses the Content Hierarchy, which includes classes that represent publishable items of data, such as list items. There are also classes that represent nested containers of data, such as lists, content databases, Web sites, collections of Web sites, and groupings of site collections called Web applications.
For a discussion of the entities that are represented by the classes in the hierarchy, see Background: Content Entities in Microsoft SharePoint Foundation.
The Physical Objects Hierarchy; which includes classes that represent physical entities, such as servers and files, and containers of such entities, such as farms and folders; is discussed in Physical Objects Hierarchy of Microsoft SharePoint Foundation.
The third hierarchy, the Services Hierarchy, includes classes that represent services and instances of services. This hierarchy is discussed in Services Hierarchy of Microsoft SharePoint Foundation.
These hierarchies overlap in the sense that some classes cannot be easily categorized and can be regarded as belonging to more than one hierarchy.
The seven major classes in the Content Hierarchy are shown in Figure 1.
The class has a very rich set of members for programmatic administration and customization of the Web site.
A hierarchy of Web sites always has exactly one top-level Web site. This site is the child of an SPSite object.
What is called a "Web site" (or occasionally just a "site") in SharePoint Foundation was called a "Web" in the original version of SharePoint Foundation—Microsoft SharePoint Team Services. Therefore, the class that represents it is called SPWeb. Similarly, a site collection was called simply a "site", which is why the class that represents a site collection is named SPSite.
An SPSite object represents a collection of Web sites, but the SPSite class is not a collection in the sense of a class that implements ICollection. (An SPSiteCollection class implements the latter interface. It represents a collection of SPSite objects.)
Some characteristics of the SPSite class are as follows:
The SPSite class has a RootWeb property that holds its child top-level Web site. (Top-level Web sites were called "root webs" in the first version of SharePoint Foundation, Microsoft SharePoint Team Services.) In turn, the SPWeb object that represents the top-level Web site has a Webs property that holds all its immediate child subsites (but not the subsites of those subsites). (The property returns all the subsites and the top-level Web site.)
SPSite has many members that you can use to develop administration functionality. Some of the more important members can help in the administration of the following:
The maximum length of Web site URLs
Dead Web sites
Ownership of the site collection
Size quotas for the site collection
Site usage data
Workflows in the site collection
Templates and Web part galleries
Self-service site creation
About half the methods of the SPSite class are Get* methods that return information of some kind, and most of its properties are read-only.
An SPContentDatabase object represents an SQL Server database that contains all the data (lists, list items, blog posts and comments, wiki pages, and documents in document libraries) and most of the page files that constitute the site collections that belong to the database.
Some characteristics of the SPContentDatabase class:
SPContentDatabase has many members that can be used for developing administration functionality. Some of the more important members can help in the administration of the following:
Backup and restoration of the database
Upgrades of the database
Migration of (moving) the database
Repairs of the database
The database connection string and logon username and password
Limiting the number of site collections
Most of the properties of SPContentDatabase are read-only.
An SPWebApplication object represents a content-publishing Web application in SharePoint Foundation. It contains one or more content databases which hold the data of one or more site collections. Each such Web application is served by an IIS Web site and typically has its own application pool in IIS.
Some characteristics of the SPWebApplication class:
An SPWebApplication object is a child of an SPWebService object. (For more information about the SPWebService class see in Services Hierarchy of Microsoft SharePoint Foundation.)
The SPWebApplication class has a ContentDatabases property that holds all its child SPContentDatabase objects. (It also has a Sites convenience property that enables you to get a reference to all the site collections of all its content databases without first getting a reference to one or more of the content databases.)
Like the Central Administration application, the SPWebApplication class enables administrators to access IIS properties without opening IIS Manager. For example, there is an IisSettings property, and there is an ApplicationPool property that provides programmatic access to the properties of the IIS application pool to which the SharePoint Foundation Web application is assigned.
SPWebApplication inherits from SPPersistedObject, which means that an object of the class persists in the configuration database. (For more information about using such objects in your code, see Overview: Using the Object Model to Customize Administration and Walkthrough: Creating a Content Service Object.)
SPWebApplication has many members that can be used for developing administration functionality. Some of the more important members can help in the administration of the following:
Backups and restorations of the Web application
Logging of changes to the Web application
External workflow participation
Use of the Windows Live MetaWeblog API
Use of the Recycle Bin
Unused site collections
Web.config file modifications
When a Web application needs to consume data or processing functionality provided by a service application, it does through an SPServiceApplicationProxy.
The SPWebApplication class has a close relation to the SPHttpApplication class. Objects of the latter class are HTTP request handlers. The process (IIS application pool) to which a SharePoint Foundation Web application is assigned has one or more SPHttpApplication objects that handle the page requests directed to the Web application.