Hour 3. Starting Development with SharePoint 2010

What You’ll Learn in This Hour:

Understanding SharePoint solutions as deployment units

Introducing SharePoint features

Debugging SharePoint solutions


By the Way

Due to the complexity of the topics discussed, some figures in this book are very detailed and are intended only to provide a high-level view of concepts. Those figures are representational and not intended to be read in detail.


Hour 1, “Introducing SharePoint 2010,” gave you an overview of SharePoint 2010, and Hour 2, “Understanding the SharePoint 2010 Architecture,” looked at SharePoint’s architecture. If you are the typical developer, by now you are probably anxious to write some code. In this hour you begin by writing code in SharePoint 2010 in the form of a console application. After that you learn about SharePoint features and solutions, and then write your first SharePoint feature. Finally you learn about debugging techniques in SharePoint and how they differ from a normal ASP.NET application.

You just wrote your first code and used two important objects of the SharePoint Object model that you will find yourself using almost everywhere. The SPSite represents a SharePoint site collection. The SPWeb represents a site within the site collection. In this case we are accessing the top level site by making a call to the OpenWeb() function of the SPSite. We could have also accessed the top level site by accessing the RootWeb property of the SPSite. However, it was important for you to see the OpenWeb() method and overload that you will be using to access the subsites method as well. Hour 7, “Understanding SharePoint 2010 Server Side Development,” discusses most objects of the SharePoint object model in detail. However, it is helpful to get acquainted with a few of the objects that you will use frequently. You might have observed that SPSite and SPWeb represent the site collection and the site in the SharePoint hierarchy that we looked at in Hour 2. Following are the other objects in the SharePoint hierarchy:

SPFarm—This class represents a SharePoint farm and is a part of the Microsoft.SharePoint.Administration namespace. You can access the local farm instance through the SPFarm.Local object.

SPWebApplication—This class represents a SharePoint web application and is also a part of the Microsoft.SharePoint.Administration namespace. You can access the WebApplication instance of a site through the WebApplication property of the SPSite class instance.

SPContext—This is an important class that represents the context of the request in SharePoint. You can access various important objects of SharePoint like the SPSite and SPWeb instances for the current request through this object. To get access to this object you call SPContext.Current.


Watch Out!

You should never dispose objects from SPContext or it will have unpredictable effects on your SharePoint applications.



Watch Out!

The SPContext.Current will be always null in a console application.


You will see as you proceed further in this book that SharePoint provides a rich object model, and you learn about many objects in detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset