Your SlideShare is downloading. ×

Share Point Object Model


Published on

This presentation is for explaining the basics of SharePoint Object Model/Web Services. These sessions are done online. Check more details @ …

This presentation is for explaining the basics of SharePoint Object Model/Web Services. These sessions are done online. Check more details @

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Online Training on SharePoint 2007
    Check Training Details @Training Details
    Moss Experts
  • 2. SharePoint Object Model, Web Services, Features and Solutions
    Moss Experts
  • 3. Features of SharePoint Object Model
    SharePoint will use ASP.NET instead of ISAPI for base page execution
    Server Object Model for programmatic access to SharePoint data
    Exposing Data via XML web services for access from remote machines
    Managed code object model on the server
    Accessible via ASP.NET or any other server process
    Exposes almost of all of the data stored in WSS
    Implemented in C#
    Add Microsoft.SharePointdll from Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPI
  • 4. SharePoint Object Model
    It gives us full access to SharePoint
    Only available on the server
  • 5. Examples of what can be done with the Object Model:
    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!
  • 6. Object Model Hierarchy
  • 7. Microsoft.SharePoint.Administration : Provides administrative types and members for managing a Windows SharePoint Services deployment.
  • 8. The SPFarm object is the highest object within the Windows SharePoint Services object model hierarchy. The Servers property gets a collection representing all the servers in the deployment, and the Services property gets a collection representing all the services.
    Each SPServer object represents a physical server computer. The ServiceInstances property provides access to the set of individual service instances that run on the individual computer.
    An SPWebService object provides access to configuration settings for a specific logical service or application. The WebApplications property gets the collection of Web applications that run the service.
    An SPDatabaseServiceInstance object represents a single instance of a database service running on the server computer.
    Each SPWebApplication object represents a load-balanced Web application based in Internet Information Services (IIS). The SPWebApplication object provides access to credentials and other server farm wide application settings. The Sites property gets the collection of site collections within the Web application, and the ContentDatabases property 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 SharePoint Web application.
    An SPSiteCollection object represents the collection of site collections within the Web application.
  • 9. Microsoft.SharePoint: Provides types and members for working with a top-level site and its sub sites
  • 10. Each SPSite object, represents a set of logically related SPWeb objects. Such a set is commonly called 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.
    Each SPList object has members that are used to manage the list or access items in the list. The GetItems method can be used to perform queries that return specific items. The Fields property returns an 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.
  • 11. Example Objects
    List Data
  • 12. Accessing Data in a MOSS List
    Get a SPList or SPDocumentLibrary object.
    SPListmylist = web.Lists[“Events”];
    You can then call the .Items property to get all of the items:
    SPListItemCollection items = mylist.Items;
    If you only want a subset of the items, call the GetItems method and pass a SPQuery object
    SPListItemCollection items = mylist.GetItems(query);
  • 13. Full Example
    SPWeb web = SPControl.GetContextWeb(Context);
    SPList tasks = web.Lists["Tasks"];
    SPListItemCollection items=tasks.Items;
    foreach(SPListItem item in items)
    output.Write(item["Title"].ToString() + item["Status"].ToString() + "<br>");
  • 14. Code Example -- Enumerate sites and lists
    SPSitemySite = SPContext.Current.Site;
    SPWebCollectionsubSites = mySite.AllWebs;
    for (inti=0;i<subSites.Count;i++)
    SPListCollection lists = subSites[i].Lists;
    for (int j=0;j<lists.Count;j++)
    + " :: " + SPEncode.HtmlEncode(lists[j].Title) + "<BR>");
  • 15. SharePoint Web Services
    SharePoint have web services APIs for accessing content. The web services layer is built on top of the server OM.
    Web Services are available remotely
    Allows manipulation of Lists, Webs, Views, List Items, etc.
    Functionality will be similar to server object model.
    Not all OM functionality available
  • 16. Getting Started With Web Services
    Create a Windows Application
    In Visual Studio, choose ‘Add Web Reference’
    Enter http://<server>/_vti_bin/lists.asmxto access the lists web service
    Other services include:
    UserGroups.asmx – users and groups
    Webs.asmx – Web information
    Views.asmx – View information
    Subscription.asmx – Subscriptions
  • 17. Feature
    • Essentially a chunk of code
    • 18. Features make it easier to activate or deactivate functionality.
    • 19. Provide scope for deployment.
    • 20. All the functionality has been grouped as bunch of features in SharePoint.
  • 21. Feature
    • Demo
    • 22. Activate Feature
    • 23. De-Activate Feature
    • 24. Show the Effects of Activation and De-Activation
  • 25. Solution
    • A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assembliesFeatures make it easier to activate or deactivate functionality.
    • 26. Solutions can be enabled or disabled.
    • 27. A solution file has a .CAB-based format but a .WSP extension.
  • 28. Terms with Solutions
    • Manifest.xml
    • 29. This file defines the list of features such as site definitions, resource files, Web Part files, and assemblies to process.
    • 30. Only the resources included in this file are processed.
    • 31. DDF File
    • 32. Defines the structure of the .cab file
    • 33. makecab.exe tool to create the solution package.
  • Solution Overview
  • 34. Online Training on SharePoint 2007
    Check Training Details @Training Details
    Moss Experts