Friday, July 6, 2012

SharePoint 2010 Foundation server architecture

SharePoint 2010 Foundation server architecture

Microsoft SharePoint Foundation is a free version of of sharepoint 2010 offers a highly structured server-side object model that makes it easy to access objects that represent the various aspects of a SharePoint Web site.
The following diagram shows the SharePoint 2010 Foundation server architecture in relation to the collections and objects of the Microsoft.SharePoint.Administration namespace.
Click on image to zoom

Here is the explation of each point of the SharePoint 2010 Foundation server architecture from top to down:-

1. SPFarm : SPFarm object is the highest object within the SharePoint 2010 Foundation object model hierarchy. it is designed to interact with the configuration data store. It contains global settings for all the servers, services, and solutions that are installed in a server farm. and the Services property gets a collection representing all the services.

Sharepoint SPFarm Example: the following example shows : services and status in sharepoint server farm

SPFarm myFarm = SPFarm.Local;
SPServiceCollection myServiceCollection = myFarm.Services;
foreach (SPService myService in myServiceCollection)
Label1.Text += myService.Name + " " + myService.Status + "";

2. SPServer : SPServer object represents a physical server computer in the server form. The Service Instances property provides access to the set of individual service instances that run on the individual computer. Use either the Servers property of the SPFarm class, or the SPServerCollection constructor, to get the collection of servers that are used in the specified server farm.

Sharepoint SPServer Example : The following example modifies the name and role of an existing server in the server farm.

SPServerCollection servers = SPFarm.Local.Servers;
SPServer myServer = servers["myExistingServer"];
myServer.Name = "NewServerName";
myServer.Role = SPServerRole.Application;

3. SPService : SPService object represents a logical service installed in the server farm. Derived types of the SPService class include, for example, objects for Windows services, such as the timer service, search, the database service, etc. and also objects for Web services, such as the basic content publishing Web service which supports the Web applications.

Sharepoint SPService Example : The following example iterates through the timer jobs history for each service in the farm and reruns any timer jobs that have failed in the past hour.

DateTime oneHourAgo = DateTime.UtcNow.AddHours(-1);
List<Guid> rerunJobIds = new List<Guid>();
foreach (SPService service in SPFarm.Local.Services)
foreach (SPJobHistory entry in service.JobHistoryEntries)
// stop if the entry didn't occur in the last hour
if (entry.EndTime < oneHourAgo)
if (entry.Status == SPRunningJobStatus.Failed &&
SPJobDefinition job = SPFarm.Local.GetObject(
entry.JobDefinitionId) as SPJobDefinition;
if (job != null)
// don't rerun the same job twice.

4. SPWebService : SPWebService represents a Web service that contains one or more Web applications. The WebApplications property gets the collection of Web applications that run the service. and the Web service allows a Web browser to access the content in SharePoint sites.

Sharepoint SPWebService Example : The following example iterates through all of the Web services in a server farm and changes the maximum site count and warning site count of all the content databases that are used for each Web application.

SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local);
foreach (SPWebService webService in webServices)
foreach (SPWebApplication webApp in webService.WebApplications)
if (!webApp.IsAdministrationWebApplication)
SPContentDatabaseCollection contentDatabases = webApp.ContentDatabases;
foreach (SPContentDatabase database in contentDatabases)
database.WarningSiteCount = 4900;
database.MaximumSiteCount = 5000;

5. Service Application Framework : Service Application Framework provides developers the ability to build scalable middle-tier shared services. Service Application Framework applications is also very helpful while load balancing and a common management and deployment experience in SharePoint 2010. 
this can be tied to a single farm or can be shared across farms.

Sharepoint Service Application Framework Example : An example of a service built on this framework is SharePoint Server search. SharePoint Server search runs on multiple application servers in a SharePoint farm.

No comments: