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;
myServer.Update();

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)
break;
if (entry.Status == SPRunningJobStatus.Failed &&
!rerunJobIds.Contains(entry.JobDefinitionId))
{
SPJobDefinition job = SPFarm.Local.GetObject(
entry.JobDefinitionId) as SPJobDefinition;
if (job != null)
{
job.RunNow();
// don't rerun the same job twice.
rerunJobIds.Add(entry.JobDefinitionId);
}
}
}
}

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;
database.Update();
}
}
}
}

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.



Thursday, July 5, 2012

Sharepoint 2010 14 hive directory structure


In Sharepoint 2010 microsoft has replaced the "12 hive" directory structure that we had in SharePoint 2007/Moss2007 with "14 Hive" directory structure in sharepoint 2010.

Some of the new folders came for 14 hive in sharepoint 2010


Click on image to zoom


Sharepoint 2010 14 hive path

the path of 14 hive folder is: C\Program Files\Common files\Microsoft Shared\Web Server Extensions\14

This directory is the installation directory for core SharePoint 2010 Server files, and all the major task are handled by this directory.

Here i would like to explain in detail 14 hive directory structure, none of the underlying folders really have changed but a few things have been added.

Sharepoint 2010 14 hive ADMISAPI


The path for sharepoint point 2010 14 hive ADMISAPI folder is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\14\ADMISAPI


Use of the 14 hive ADMISAPI directory : - Sharepoint 2010 14 hive ADMISAPI directory contains the soap services for Sharepoint 2010 Central Administration. If 14 hive ADMISAPI directory is altered, then the remote site creation and other methods exposed in the service will not function correctly.

Sharepoint 2010 14 hive CONFIG

The path for sharepoint point 2010 14 hive CONFIG directory is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\14\CONFIG

Use of the 14 hive CONFIG directory : - Sharepoint 2010 14 hive CONFIG directory contains files used to extend IIS Web sites with SharePoint Server. If this directory or its contents are altered, Sharepoint web application provisioning will not function correctly.

Sharepoint 2010 14 hive LOGS

The path for sharepoint point 2010 14 hive LOGS directory is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\14\LOGS -

Use of the 14 hive LOGS directory : - Sharepoint 2010 14 hive LOGS directory contains setup and run-time tracing logs.



Sharepoint 2010 14 hive newly added folder

Sharepoint 2010 14 hive Policy

Path for sharepoint point 2010 14 hive Policy directory is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\Policy -

Sharepoint 2010 14 hive UserCode

Path for sharepoint point 2010 14 hive UserCode directory is : -Program Files\Common files\Microsoft Shared\Web Server Extensions\UserCode -



Use of the 14 hive UserCode directory : - Sharepoint 2010 14 hive UserCode directory contains files used to support your sandboxed solutions.


Sharepoint 2010 14 hive WebClients

Path for sharepoint point 2010 14 hive WebClients directory is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\WebClients -



Use of the 14 hive WebClients directory : - Sharepoint 2010 14 hive WebClients directory contains files related to the new Client Object Model.


Sharepoint 2010 14 hive WebServices

Path for sharepoint point 2010 14 hive WebServices directory is : - Program Files\Common files\Microsoft Shared\Web Server Extensions\WebServices -



Use of the 14 hive WebServices directory : - Sharepoint 2010 14 hive WebServices directory contains new wcf or .svc related files.




Note : You should rewrite and recompile any code that refers to files and resources in "12" Hive structure.For example, if you have redeployed all of your files into the "14" folder and emptied your "12" folder, any references to files under the "12" folder will not work.


Sharepoint STSADM Interview Questions and Answers

What is sharepoint stsadm?

Stsadm ”stands for SharePoint Team Services Administration"
It is a Command-line tool used for administration of Office SharePoint 2007 (or MOSS 2007) servers and sites and even its not Not limited to administrative needs – can be extremely helpful to developers.

Where the sharepoint stsadm is it located?

You will normally find stsadm,  under C:\Program Files\Common Files\ shared\web server extensions\12\bin.

Permissions are required to perform sharepoint stsadm operations?

To use Stsadm.exe, you must be a member of the local Administrators group for the server computer.
In addition to this you definitely need access to the required sharepoint databases so that you should not get any errors while deploying sharepoint solutions.

How to cancel a stsadm deployment if it is stuck at “deploying” or “Error”

You can either try to force execute timer jobs using execadmsvcjobs command or can cancel the deployment using stsadm command
"stsadm –o cancaldeployment –id {GUID} command."
The Id here would be GUID of the timer or deployment job. You can get the Id from stsadm enumdeployment command. This will display all the deployments which are inprocess or are stuck with Error.

How to perform operations on File system or registry of the server with stsadm command ?

Sharepoint Stsadm does not allow you to access file system or registry. It is a tool to perform administrative tasks for SharePoint farms only.

Backup and Restore sites with Sharepoint stsadm?

For backup using sharepoint stsadm
stsadm -o backup -url "http://Siteurl" -filename C:\Backup\BackupSite.bak
For Restore using sharepoint stsadm
stsadm -o restore -url "http://retsoredsite" -filename C:\Backup\BackupSite.bak
Is stsadm backup or restore different from Import or export?
Sharepoint Stsadm Backup or retsore allows you to backup either a site collection or a complete web application. It can also overwrite the exiting site collection for the destination url.
Export or Import - This operation allows you to backup or restore a site, sub site or a SPWeb instance. You can move this site or sub site under any existing site in your farm, across multiple site collections.

Is stsadm working with SharePoint 2010?

it was a rumors that new Power Shell 2.0 will replace the stsadm tool. but sharepoint 2010 fully supports the stsadm. but for the best practice always use powershell if you are using sharepoint 2010.


Related Article : Sharepoint Stsadm Commands List