Friday, January 18, 2013

SharePoint 2010 - Server Object Model

Overview
As you might already know that the SharePoint 2010 is built upon .Net 3.5 framework and Asp.Net. Therefore, the SharePoint infrastructure provides a rich .Net object model for developing solutions using compatible server side language like (C#, VB.NET etc). This Server Object Model comprises a set of namespaces and classes which must run on a SharePoint server because this is the only server on which the Server Object Model runs; it has some dependencies that are satisfied only on servers in a SharePoint farm.

Startup Environment
  • If you use the default Visual Studio configuration, you should change the Target Framework setting in the Application configuration tab of the project from “.NET Framework 4.0 Client Profile” to “.NET Framework 3.5.” 
  • You should also change the Platform Target setting in the Build configuration tab of the project from “x86” to “x64” or to “Any CPU,” because Microsoft SharePoint 2010 works on 64-bit machines only.
  • The "Microsoft.SharePoint.dll" is the main server object model assembly which comprises of  the following 2 important namespace.
    • "Microsoft.SharePoint" - Consists of classes and members for developing solution in a top level SiteCollection, its subsites or lists (eg: SPSite, SPWeb etc).
    • "Microsoft.SharePoint.Administration" - Consists of classes and members for developing solutions at an admistrative level. (eg: SPFarm, SPServer etc)
  • When you create a SharePoint project in Visual Studio 2010, the "Microsoft.SharePoint.dll" assembly is automatically referenced.
  • On the other hand, for windows Console\WinForm applications, you need to reference "Microsoft.SharePoint.dll" explicitly. You can find it, along with many of the other assemblies, in the SharePoint14_Root\ISAPI folder.

Server Architecture
The following figure gives you a clear idea about the SharePoint Server Architecture with reference to "Microsoft.SharePoint.Administration" namespace.
From the above figure you can summarize the following point:
  • The "SPFarm" object is the highest object within the SharePoint Foundation object model hierarchy.
  • Each "SPServer" object represents a physical server computer. 
  • Each "SPService" object represents a logical service installed in the server farm.The WebApplications property gets the collection of Web applications that run the service.
  • An "SPWebService" object provides access to configuration settings for a specific logical service or application
  • Each "SPWebApplication" object represents a Web application hosted in an Internet Information Services (IIS) Web site. The Sites property gets the collection of site collections within the Web application, and the ContentDatabases property gets the collection of content databases used in the Web application.
  • The Sites property gets the collection of site collections within the Web application, and the ContentDatabases property gets the collection of content databases used in the Web application.
  • An "SPContentDatabase" object inherits from the "SPDatabase" class and represents a database that contains user data for a Web application.
Site Architecture
The following figure will give you a better idea about the SharePoint Site Collection Architecture with reference to "Microsoft.SharePoint" namespace.
From the above figure you can easily summarize the following points:
  • The "SPSite" object represents a Site Collection. 
  • Each site collection includes any number of "SPWeb" objects, and each object has members that can be used to manage a site, including its template and theme, as well as to access files and folders on the site.
  • The "SPListCollection" object that represents all the lists in the site.
  • Each "SPList" object has members that are used to manage the list or access items in the list. 
  • The "SPFieldCollection" object that represents all the fields, or columns, in the list, and the Items property returns an "SPListItemCollection" object that represents all the items, or rows, in the list.
  • Each "SPField" object has members that contain settings for the field.
  • Each "SPListItem" object represents a single row in the list.
Conclusion
This is just a basic overview of overall Server Object Model architecture. In the next post we will dig in further into the Object Model Hierarchy. Stay Tuned!

References
1) http://msdn.microsoft.com/en-us/library/ms473633(v=office.14).aspx

1 comment:

Note: Only a member of this blog may post a comment.