Microsoft SharePoint Foundation offers a highly structured server-side object model . Here are some comparisons
The objects in the object hierarchy include SPFarm, SPService, SPWebApplication, SPSite, SPWeb, SPList, and SPListItem
Location difference
-----------
asp.net: wwwroot/webapp/web.config
sharepoint:wwwroot/wss/virtualdirectries/5555/web.config
Major Differences
Sharepoint modiefies the pipeline
loading resource from DB
non asp.net related contenet
no compile mode
control restriction on page
Sharepoint :
SPService (base class for services) is also used in this context for Services for administration.
eg: http://sp2010:2120 . This is server url in asp.net. But this is a web application in SharePoint.
For a .Net web developer, 'Web application' used to be the template you add in a VS solution.
When you create a Web application by using the SharePoint Central Administration application, an IIS Web site is automatically created. You can verify whether the IIS Web site has been created by looking in IIS Manager, where you can see its structure, Web.config file, and virtual directory mappings. Information workers/end users do not browse to SPWebApplication. They actually browse to SharePoint Sites, which are SPWeb objects(explained later).
As a developer, it is also possible to create Web applications by adding SPWebApplication objects to the WebApplications collection of a SPWebService object,. But only to replace the SharePoint Central Administration application. Usually you will work with an existing SPWebApplication to access its collection of SPSite objects, or to control application-wide settings(alert config).you might write code to add or modify Web.config settings for a Web application by using the SPWebConfigModification class.
Instantiating SPSite Objects: You can work with SPSite objects in a very flexible way. For example, you can instantiate SPSite objects by doing any of the following:
SPWeb objects are effectively a broad unit of storage, as they expose SPListCollection objects that contain pages libraries, lists, and document libraries. An important concept is that one SPWeb object can also contain other SPWeb objects to represent sites and sub-sites from the information worker's perspective. SPWeb represents a website from a end user experience. It is the container for items like lists and pages and so forth
Instantiating SPWeb Objects
----
Disposal
[to be continued]
The objects in the object hierarchy include SPFarm, SPService, SPWebApplication, SPSite, SPWeb, SPList, and SPListItem
-----------
asp.net: wwwroot/webapp/web.config
sharepoint:wwwroot/wss/virtualdirectries/5555/web.config
Sharepoint modiefies the pipeline
loading resource from DB
non asp.net related contenet
no compile mode
control restriction on page
- Farm-SPFarm:
SPService (base class for services) is also used in this context for Services for administration.
- Web Application-SPWebApplication(traditional ISS web site equivalent with SP configured)
eg: http://sp2010:2120 . This is server url in asp.net. But this is a web application in SharePoint.
For a .Net web developer, 'Web application' used to be the template you add in a VS solution.
When you create a Web application by using the SharePoint Central Administration application, an IIS Web site is automatically created. You can verify whether the IIS Web site has been created by looking in IIS Manager, where you can see its structure, Web.config file, and virtual directory mappings. Information workers/end users do not browse to SPWebApplication. They actually browse to SharePoint Sites, which are SPWeb objects(explained later).
As a developer, it is also possible to create Web applications by adding SPWebApplication objects to the WebApplications collection of a SPWebService object,. But only to replace the SharePoint Central Administration application. Usually you will work with an existing SPWebApplication to access its collection of SPSite objects, or to control application-wide settings(alert config).you might write code to add or modify Web.config settings for a Web application by using the SPWebConfigModification class.
- Site Collection- SPSite
Instantiating SPSite Objects: You can work with SPSite objects in a very flexible way. For example, you can instantiate SPSite objects by doing any of the following:
- Passing in a Url to its constructor.
- Referencing a member of the Sites collection of a SPWebApplication
- Referencing the current context site
- SPWeb:
SPWeb objects are effectively a broad unit of storage, as they expose SPListCollection objects that contain pages libraries, lists, and document libraries. An important concept is that one SPWeb object can also contain other SPWeb objects to represent sites and sub-sites from the information worker's perspective. SPWeb represents a website from a end user experience. It is the container for items like lists and pages and so forth
Instantiating SPWeb Objects
- As the RootWeb property of an SPSite object.
- As a member of the AllWebs collection of an SPSite object.
- As the return value of the OpenWeb method of an SPSite object.
- By referencing the current context Web.
- Lists(SPList,also SPFile for documents)
----
Disposal
SPSite - wrap in 'using '
automatically disposes SPWeb(those that gets lazily initialised)
SPWeb-if you are creating it then you dispose.
SPContext
Do not dispose as (Sharepoint handles)
Tip: check intelisense for a dispose method . if it has then dispose it
for more on disposal
----------start working
To create a SharePoint site programmatically, you add an SPWeb object to an SPWebCollection object. Existing sites expose a Webs property of type SPWebCollection, so you can use the Add method of this Webs property to create a subsite.
----------start working
To create a SharePoint site programmatically, you add an SPWeb object to an SPWebCollection object. Existing sites expose a Webs property of type SPWebCollection, so you can use the Add method of this Webs property to create a subsite.