Ads

Wednesday, 3 April 2013

Details of SharePoint 2010 Object Model Hierarchy while doing C# codes

  • SPFarm – Represents farm-level settings.
    • Class and global, static object
    • Cannot create or dispose
    • Will only be used if creating Admin type of tools.
  • SPService – Represents farm wide services
    • SPWebService is a type of SPService – Each Web application belongs to an SPWebService.
    • Forms, Access, PerformancePoint, Search, Excel, User Profile, Business DataConnectivity, Managed Metadata.
    • Will only be used if creating Admin type of tools.
    • It is a base class that other specific services inherit.
  • SPWebApplication – Maps to IIS Web sites
    • Can create and delete web applications (usually done in admin).
  • SPSite – Represents Site Collections
    • Each have a RootWeb
    • Contains site level features and solutions
    • Instantiate by:
      • Using it’s constructor.
      • Member of Sites collection of the SPWebApplication.
      • Referencing the current site context.
    • Usually represents a security boundary.
  • SPWeb – Represents SharePoint Sites
    • Consider SPWeb objects as storage units.
    • Contains pages, lists, libraries, subwebs.
    • Instantiate by:
      • RootWeb of SPSite object.
      • Member of AllWebs collection in SPSite.
      • Return value of the OpenWeb method of a SPSite object.
      • Referencing the current context web.
  • SPList – Primary container for data.
    • Contains data and exposes properties.

Both SPSite and SPWeb Objects need to be disposed because they have underlying COM objects thatperform some tasks.

No comments:

Post a Comment

Ads