Share Point Object Model

  • 5,094 views
Uploaded 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 @ http://manish-sharepoint.blogspot.com/2009/02/online-training-on-sharepoint.html

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,094
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
0
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Online Training on SharePoint 2007
    Check Training Details @Training Details
    Moss Experts
    http://manish-sharepoint.blogspot.com/
  • 2. SharePoint Object Model, Web Services, Features and Solutions
    Moss Experts
    http://manish-sharepoint.blogspot.com/
  • 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
    http://manish-sharepoint.blogspot.com/
  • 4. SharePoint Object Model
    It gives us full access to SharePoint
    Only available on the server
    http://manish-sharepoint.blogspot.com/
  • 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!
    http://manish-sharepoint.blogspot.com/
  • 6. Object Model Hierarchy
    http://manish-sharepoint.blogspot.com/
  • 7. Microsoft.SharePoint.Administration : Provides administrative types and members for managing a Windows SharePoint Services deployment.
    http://manish-sharepoint.blogspot.com/
  • 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.
    http://manish-sharepoint.blogspot.com/
  • 9. Microsoft.SharePoint: Provides types and members for working with a top-level site and its sub sites
    http://manish-sharepoint.blogspot.com/
  • 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.
    http://manish-sharepoint.blogspot.com/
  • 11. Example Objects
    Security
    SPGroup
    SPGroupCollection
    SPSite
    SPUser
    SPUserCollection
    Documents
    SPDocumentLibrary
    SPFile
    SPFileCollection
    SPFolder
    List Data
    SPField
    SPFieldCollection
    SPListCollection
    SPList
    SPListItemCollection
    SPListItem
    SPView
    Administration
    SPGlobalAdmin
    SPQuota
    SPVirtualServer
    http://manish-sharepoint.blogspot.com/
  • 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);
    http://manish-sharepoint.blogspot.com/
  • 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>");
    }
    http://manish-sharepoint.blogspot.com/
  • 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++)
    {
    Response.Write(SPEncode.HtmlEncode(subSites[i].Title)
    + " :: " + SPEncode.HtmlEncode(lists[j].Title) + "<BR>");
    }
    }
    http://manish-sharepoint.blogspot.com/
  • 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
    http://manish-sharepoint.blogspot.com/
  • 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
    http://manish-sharepoint.blogspot.com/
  • 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.
    http://manish-sharepoint.blogspot.com/
  • 21. Feature
    • Demo
    • 22. Activate Feature
    • 23. De-Activate Feature
    • 24. Show the Effects of Activation and De-Activation
    http://manish-sharepoint.blogspot.com/
  • 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.
    http://manish-sharepoint.blogspot.com/
  • 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
    http://manish-sharepoint.blogspot.com/
  • 34. Online Training on SharePoint 2007
    Check Training Details @Training Details
    Moss Experts
    http://manish-sharepoint.blogspot.com/