Partilhar via


Content Hierarchy of SharePoint Foundation

Applies to: SharePoint Foundation 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.

Important

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.

Note

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 Content Hierarchy

The seven major classes in the Content Hierarchy are shown in Figure 1.

Figure 1. The primary objects in the content hierarchy

Primary objects in the content hierarchy

Each type of object in Figure 1 contains objects of the type underneath it. The SPList, SPListItem, and SPField classes are not discussed in this topic.

SPWeb

An SPWeb object represents a SharePoint Foundation Web site. Some characteristics of the SPWeb class are as follows:

  • An SPWeb object can be a child of another SPWeb object or of an SPSite object. If it is the child of an SPSite object, it is the top-level Web site in its site collection.

  • An SPWeb object has a Webs property that returns a collection of other SPWeb objects; specifically, the immediate child subsites under it.

  • 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.

Note

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.

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:

  • An SPSite object represents a subset of the content of an SPContentDatabase object.

  • 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 AllWebs 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

    • RSS feeds

    • Auditing

    • Dead Web sites

    • Features

    • 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.

SPContentDatabase

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:

  • An SPContentDatabase object is a child of an SPWebApplication object. The collection of a Web application's content databases are referenced in the Web application's ContentDatabases property.

  • The SPContentDatabase class has a Sites property that holds all of its child SPSite objects.

  • SPContentDatabase inherits from SPPersistedObject, which means that an object that instantiates the class persists in the configuration database.

  • 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.

SPWebApplication

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:

    • Security policy

    • Alerts

    • Document conversions

    • Backups and restorations of the Web application

    • Logging of changes to the Web application

    • Outbound e-mail

    • 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.

See Also

Reference

SPWebApplication

SPDatabase

SPSite

Concepts

Server and Site Architecture: Object Model Overview

Working with List Objects and Collections

Overview: Using the Object Model to Customize Administration

Code Sample: Using the Administration Object Model

Content Hierarchy of SharePoint Foundation

Background: Content Entities in Microsoft SharePoint Foundation

Physical Objects Hierarchy of Microsoft SharePoint Foundation

Background: Physical Objects in Microsoft SharePoint Foundation

Services Hierarchy of Microsoft SharePoint Foundation

Background: Service Entities in Microsoft SharePoint Foundation

Other Resources

Administrative Object Model of Microsoft SharePoint Foundation

SharePoint Foundation Administration