Windows SharePoint Services 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. From higher-level objects, you can drill down through the object hierarchy to obtain the object that contains the members you need to use in your code.
What can be done with OM :-
· Add, edit, delete, and retrieve data from SharePoint Lists
· Create new lists and set list metadata (e.g. the fields in a list)
· Set web properties
· Work with documents in document libraries.
· Perform administrative tasks such as creating webs, adding users, creating roles, etc.
· Pretty much any functionality in the UI can be automated through the OM!
Important Classes of Object Model:-
SPSite
SPContext
SPWeb
SPList
SPListItem
SPListItemCollection
SPField
SPDocumentLibrary
SPFile
SPFolder
SPContentType
SPQuerySPSiteDataQuery
Example:-
· If you are creating a Web Part, custom Web service, or Web application to work with site collections, individual sites, or lists, you can use members of the Microsoft.SharePoint.SPContext class to obtain the current site collection, Web site, or list.
· Outside of an HTTP context, such as in a console application or a Windows application, use a constructor of the SPSite class to obtain a specific site collection and to reach various objects within the collection
No comments:
Post a Comment