SharePoint [architecture series]-Server Object Model of SharePoint 02. content hierarchy

Source: Internet
Author: User

The content hierarchy of SharePoint includes publishable items, such as the list item class, and nested containers of data ), such as list, content database, website, website set, and website set group called "Web application.

The main objects in the content hierarchy are as follows:

Here we further divide the content hierarchy of SharePoint into three layers:

I. High-level Object Model)

In the SharePoint field, the highest level content container is the Web application, which is represented by the spwebapplication class.

SpwebapplicationObject

The spwebapplication object represents a web application used to publish content in SharePoint Foundation. This object contains one or more content databases to store one or more website set data. Each such Web application is provided by the IIS website and usually has its own application pool in IIS. In addition, each web application has its own security and Authentication Settings.

A SharePoint Foundation web application, represented by the spwebapplication class, is basically a set of content databases, each of which contains a website set, and the website set itself is a collection of websites, these websites are a collection of files.

However, the SharePoint Foundation web application is not only the most advanced website group, but also the layer on which SharePoint foundation is deployed to be visible to IIS. Each SharePoint Foundation web application is published on an IIS website and appears in the website tree of the IIS manager. The IIS manager of the application pool and IIS website is displayed on a Sharepoint Foundation front-end web server:

The IIS manager after SharePoint foundation is installed on a single server is displayed. Note that this installation creates two IIS websites, each of which has its own application pool (and process ).

One of the IIS websites is for the main SharePoint Foundation web application used to provide content to end users. The website name is "SharePoint-80" ("80" is the server port number, pass the port number to the SharePoint Foundation page );

Another IIS website name is "SharePoint Central Administration V3", which can be used by IT professionals for advanced management tasks. You may be able to guess why you want to create a separate SharePoint Foundation web application, rather than creating a website set or site in "SharePoint-80. By isolating the processes of two SharePoint Foundation Web applications, even if the error code on a website in "SharePoint-80" causes the subsequent web applications to crash immediately after each restart, the network administrator can still access the management center. In addition, by making management applications a separate web application, administrators can specify different policies related to identity authentication and anonymous users.

If the SharePoint foundation is installed in a farm with multiple servers, and the frontend server and backend server (called "Application Server" in SharePoint Foundation) have different configurations, then "SharePoint-80" only runs on the front-end server. "SharePoint Central Administration V3" runs on one Application Server (and only on one Application Server.

"SharePoint Central Administration V3" SharePoint Foundation Web applications outside the application are called "content publishing Web Applications ".

When you create an initial "SharePoint-80" Web application and create any content to publish a web application, a new content database will be created for the corresponding web application. Create a website set for the newly created database in sequence, and create a primary website for the newly created website set.

Therefore, all website sets and websites (and sub-websites) in the SharePoint Foundation web application are just a large website for IIS.

After an IIS website is created, IIS automatically provides its own application pool for each IIS website, and each application pool has its own process. In this way, each SharePoint Foundation web application runs in its own process. If one of the processes crashes, other processes continue to run. This is the most important difference between a Sharepoint Foundation web application and a lower layer of the Object Model hierarchy.

There is no process isolation between the content database (contentdatabase) and site collection, but Web applications have this mechanism.

Strictly speaking, you do not need to maintain a one-to-one relationship between the IIS website and the application pool. In IIS manager, you can move a website from one application pool to another. Therefore, you can move multiple SharePoint Foundation web applications to the same pool to share the same process. In some cases, it is necessary to discard crash protection in order to obtain the performance enhancement brought about by such process sharing. Even so, process sharing is not often used.

 

SpwebapplicationClass features:

• The spwebapplication object is a sub-object of the spwebservice object.
• The spwebapplication class has the contentdatabases attribute that stores all its child-level spcontentdatabase objects. (This class also has an easy-to-use sites attribute, which can be used to obtain reference to all the website sets of all its content databases, instead of getting a reference to one or more content databases .)
• Similar to the Management Center application, the spwebapplication class allows administrators to access IIS properties without opening the IIS manager. For example, the iissettings attribute and applicationpool attribute provide programmatic access to the attributes of the IIS application pool assigned to the SharePoint Foundation web application.
• Spwebapplication inherits from sppersistedobject, which means that the objects of this class will be saved in the configuration database.
• Spwebapplication has many Members that can be used for development and management. Important members can help manage such security policies, notifications, document conversion, backup and restoration of Web applications, record Web application changes, and send out emails, external workflow participation, using the Windows Live metaweblog API, using the recycle bin, unused website set, Web. config File Modification and so on:
• When a web application needs to use the data or processing functions provided by a service application, it will be completed through spserviceapplicationproxy.
• The spwebapplication class is closely related to the sphttpapplication class. The object of the next class is the HTTP request processing program. The process (IIS application pool) assigned by the SharePoint Foundation web application has one or more sphttpapplication objects that process page requests directed to the Web application.

 

SpcontentdatabaseClass

As mentioned above, each SharePoint Foundation web application has at least one content database (represented by the spcontentdatabase class), which is automatically created when a web application is created. You can add more content databases to Web applications as needed. The content database contains all the data (list, list items, blog articles and comments, documents on the wiki page and Document Library) and most page files, which constitute the website set of the database.

Some files belonging to the website set will be stored in the file system of the front-end server deployed in SharePoint Foundation. At first glance, this may damage the System of the website set as a subset of the content database. However, even if files are not stored in the content database, they are represented by rows in the database. Indicates that the table row of this type of file will be used as an alias for this file.

Some features of the spcontentdatabase class:

• The spcontentdatabase object is a sub-object of the spwebapplication object. The contentdatabases attribute of the Web application references the set of content databases of the Web application.
• The spcontentdatabase class has a sites attribute that stores all its child spsite objects.
• Spcontentdatabase inherits from sppersistedobject, which means that the object of the instantiation class will be saved in the configuration database.
• Spcontentdatabase has many Members that can be used for development and management. Some important members can help manage such as backing up and restoring databases, upgrading databases, and migrating (moving) database, repair database, database connection string, login user name and password, limit the number of website sets, etc.
• Most attributes of spcontentdatabase are read-only.
• The spwebapplication and spcontentdatabase classes are inherited from sppersistedobject. That is to say, their instantiated objects are stored in the configuration database.

 

Ii. intermediate-level Object Model (middle level Object Model)

The object model at the intermediate level is the sitecollection and its subset. Spweb objects represent a separate website object, while spsite objects represent a collection of multiple website objects in the same webapplication. The purpose of packaging is out of management needs.

Spsite class

The spsite class indicates a collection of websites, but it is not a class that implements the icollection interface. Therefore, the spsite class is not a collection. (Spsitecollection class implements the next interface. It truly represents the collection of spsite objects .)
The following are some features of the spsite class:
• The spsite object represents a subset of the content of the spcontentdatabase object.
• The spsite class has a rootweb attribute that stores its primary website. (In the first version of SharePoint Foundation, in Microsoft SharePoint Team services, the top-level webstie is called "root Website ".) The spweb object of the primary website has a subwebsite [immediate child subsites] That saves all its "direct" subwebsites (but not the subwebsites of the next level included in these direct subnet sites). (The allwebs attribute returns all sub-websites and primary websites .)
• Spsite has many Members that can be used for development management. Some important members can help with management such: maximum URL length, RSS source, review, non-active website, function, website set ownership, website set size quota, website usage data, website centralized workflow, template, and Web parts Library, self-help website creation, and other content
• About half of the spsite classes are get * methods used to return certain types of information. Most of the attributes of these methods are read-only.

The presence of a website set (represented by the spsite class) facilitates management for the website owner, server administrator, and enterprise that sells the SharePoint Foundation host service.

The following are some of the most important features of a website set:
• Compared with the SharePoint Foundation web application, the SharePoint Foundation website set provides more detailed management for Sharepoint Foundation deployment, however, the management of a specific website is still the responsibility of the website owner (who are usually not IT professionals.
• Each website set has only one primary website. For some types of management tasks, it is best to regard the website set and its primary website as a single entity. For example, the "website Settings" page of the primary website contains a "website set management" area. The primary website owner can activate the website set function in this area, and restore any deleted website set content from the recycle bin. In addition, you can create custom entities (such as custom columns) on the primary website ). Then, all websites in the website set can use these entities.
• The website Set spans the boundaries between the management responsibilities of the website owner and the management responsibilities of the website set Administrator (usually not IT professionals. As described in the previous section, some website set-level management tasks will be handled by the primary website owner. However, the server administrator and network administrator can use the "Application Management" tab of the management center to create and delete a website set and set the size and quota of the website set.
• The website set (or strictly the top website of the website set) is the most advanced object in the trace navigation. (Although users of a sub-website may not be able to access each of the more advanced websites in the hierarchy, they can see these websites in the trace navigation .)
• Feature, content type, list, theme, and workflow) the pool is maintained at the website set level and provided to sub-websites. That is to say, the master pages, Web parts, themes, lists, content types, and features in SharePoint can all be used at the site collection level. That is to say, you can deploy them at the site collection level and take effect for all sub-levels under the site collection.
• A website set is one of the four levels from which the SharePoint foundation function can be activated. The other three levels are websites, web applications, and fields.
• The user group is maintained at the website set level and assigned default permissions. (These permissions can be changed at any website, list, or list item level. You can create a group on the "website Settings" page of any website. However, no matter where the group is created, the group is at the website set level and is available to all websites in the website set .) That is, a site collection is used by Sharepoint to create a user group (create groups of users) and assign default permission.
• Master pages and Web parts can be shared within the website set rather than between the website set.

• A website set is the most advanced object in the hierarchy and can audit access to it. The audit database will be maintained at this level.
• A site collection is the smallest unit with practical backup and restoration APIs. (However, you can use the unconnected database and database snapshot functions to back up and restore the list and other more refined units.
• In SharePoint Foundation, site collection is the largest range of search functions. If your search function is to break through this range, you must use Sharepoint Server 2010.
• Content of a site collection is always stored in a single content database.
• Each website set has a website set administrator.

 

Spweb

The spweb class represents a Sharepoint Foundation website. A website is a collection of one or more web pages. It usually contains a set of lists, document libraries, content types, fields (columns) type, a group of available features, a group of user warnings, and a group of workflow instances. The website also has an owner and a group of associated users and user groups. You can add or delete all these types of entities to or from a website programmatically. Websites can also be used as search targets.
The following are some characteristics of the spweb class:
• Spweb objects can be sub-objects of another spweb object or spsite object. If it is a sub-object of the spsite object, it will be the top-level website in the website set ).
• The spweb object has a webs attribute that can return other spweb objects (specifically, the direct sub-website under it.
• This class provides a rich set of members for programming management and website customization.
• The website hierarchy must always have a primary website. This website is a sub-object of the spsite object.

A spweb class has many attributes and methods used to process website-related content, including their users, lists, fields, content types, functions, and alarms. The spweb class also contains a key update () method used to submit changes to the SharePoint foundation database.

Comparison between SharePoint websites and traditional ASP. NET websites:

A SharePoint Foundation website, represented by the spweb class, is an ASP. NET Website optimized for content management and collaboration. This website is mainly different from other ASP. NET applications in the following aspects:
• The website does not emphasize pages, but rather lists and items ). For example, the "Quick Start" of a Sharepoint Foundation website (STS type) displays the hierarchy of a website, subwebsite, and list (including list, rather than the hierarchy of pages. If you add a page to this website, the new page will appear as a new item in the shared document list in "Quick Start", rather than as a child node on the home page or some other pages.
• The website provides users with management capabilities. The capacity of any given user is determined by the permissions granted to the user. Generally, end users can create new websites (as sub-websites of existing websites) and add and edit content on existing websites.
• This website is one of the four levels on which SharePoint foundation can be activated (feature. The other three levels are site collection, web application, and farm ).
• The fact that a website is a subset of a website set does not mean that the content of two websites in a given set is mutually exclusive. For example, a given list can appear on multiple websites.

 

Creation and destruction of spsite and spweb objects:

Because the earliest version of Sharepoint is in. NET framework exists before it appears, and the spweb and spsite in SharePoint are developed from earlier versions. Therefore, even now, spweb and spsite still wrap some COM objects, which are not allowed. the garbage collection mechanism of Net Framework is automatically recycled. If you do not destroy them correctly after using them, it will easily cause memory leakage on the SharePoint farm server. Therefore, it is necessary for Sharepoint developers to call the spweb or spsite dispose method to release them in time. It is worth noting that,SpcontextObjects are managed by the SharePoint framework and should not be explicitly released in the code.Spcontext. Site,Spcontext. Current. Site,Spcontext. WebAndSpcontext. Current. WebReturnedSpsiteAndSpwebThe same is true for objects. When merging SharePoint object models on the same line, you must be cautious about the operations performed by the Runtime Library. The leakage caused by this situation is the most difficult to find.

 

3. Low-Level Object Model)

The object models at this level include list and list items, which are represented by splist and splistitem respectively.

The splist class provides many Members to support programmers to add, delete, and retrieve list items through code, and supports management such as content type and field (fields) metadata (metadata ). The efficient way to return a specific list is through the getlist method of spweb or splistcollection. The listitem class also provides members to manage fields, value of its fields, content types, and associated workflows ). The efficient method to return list items or splistitemcollection is through the splist or spweb getitem * method. Folders are represented by the spfolder class in Sharepoint. The files attribute of the spfolder class returns all files in the document library folder, while the files attribute of spweb returns the. aspx file used in the website. The effective way to return a specific folder is to use the getfolder () method of the website. Fields in the list are represented by spfield objects ..
 
Although any given list item has a specific content type associated with it, the SharePoint object model only provides the splistitem class to represent all list items. Therefore, when you operate on the list items and their fields, you are more like dealing with a weakly typed enviorment environment. Therefore, Sharepoint provides the spmetal tool. spmetal is a class of command line tools used to generate object classes, which can provide an object-oriented interface to Microsoft SharePoint Foundation content database. Although these classes are mainly used for LINQ to SharePoint queries, they can also be used to add, delete, and change list items by using concurrent conflict resolution methods. They can also be used as an alternative to the common SharePoint Foundation Object Model for reference content. The advantage of using the entity class generated by spmetal is that you can find some errors that may be detected at runtime in the encoding phase. For example, if a list contains a field named country, the programmer may use the myitem ["country"] Code to obtain the value of this field in a traditional way, if he uses a wrong field name, for example, myitem ["countyr"], such a spelling mistake can only be displayed at runtime. But when you use spmetal to generate an object class, you will see an automatic prompt for code like mytask. country, so as to avoid such errors earlier.

 

Of course, spmetal also has the following restrictions:

• Spmetal can only generate code for fields of the content type. There is no built-in ing to attributes of the splistitem object (such as the properties property package or the attachments property.
• Spmetal cannot generate code for fields that use custom field data types.
• Spmetal cannot predict the future, so it cannot map fields (columns) added to the list after the solution is deployed)

Demonstrate the relationships between SharePoint objects (including physical hierarchies and service structures, of course ).

Reprinted: http://www.cnblogs.com/wsdj-ITtech/archive/2013/01/08/2559338.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.