Download presentation
Presentation is loading. Please wait.
Published byAlexia Chandler Modified over 8 years ago
1
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview VITALE, CATURANO & COMPANY LTD SharePoint Developer Series – Architecture & Object Model Overview.: Michael Williams :. June 9, 2005
2
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 2 I.Architecture Overview II..Net Windows SharePoint Services Object Overview III.Resources IV.Questions Session Agenda
3
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 3 Web Server ISAPI Filter ISAPI Application ASP.NET Handler ASP.NET Config DB Web Farm Config Content DB Map Content DB Documents, Lists Portal DB Site, Profile Service Portal Services Search, Index, Job Architecture Overview - System Architecture Web Team DB Config DB Index Job Portal DB Profile DB Service DB Search
4
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 4 ISAPI Filter Inclusions / Exclusions Static Page Gets ASP.NET Handler Direct ( _layouts ) Safe (lists, topics, etc.) ASP.NET Page Rendering Unmanaged Code List / View Rendering Portal managed objects Content, Profile, Service, and Config DB access Architecture Overview - Web Server Components IIS ASP.NET Handler Filter Config Static Pages FrontPage RPC DAV.aspx.asmx HTTP Requests ASP.NET Content SharePoint Unmanaged Code Direct Safe ISAPI Ext ADO.NET Profile Service
5
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 5 HTTP Listener Domain, Port, IP Resolution Virtual servers Authentication Anonymous, NTLM, or Basic Application Pools Process Identity Process Isolation Application Recycling Architecture Overview - Internet Information Server IIS ASP.NET Handler Filter Config Static Pages FrontPage RPC DAV.aspx.asmx HTTP Requests ASP.NET Content SharePoint Unmanaged Code Direct Safe ISAPI Ext ADO.NET Profile Service
6
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 6 SharePoint provisions at the virtual server level No per-site collection or per-site/web metabase entries Filter directs SharePoint requests to ISAPI Application No data I/O in filter Managed Path Inclusions & Exclusions Exclusions – Directories SharePoint ignores example: /customapp → http://stssite/customapp Inclusions – Directories where sites reside Explicit Inclusions (specific site names) example: / → http://site example /sitename → http://server/sitename Wildcard Inclusions (specific folder for sites) example /teams/* → http://portal/teams/sites Architecture Overview – ISAPI Filter
7
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 7 Purpose Defines URL namespaces managed by WSS example: http://server/sites Defines self-service site creation paths example: Restrict creation to http://server/usersites Excluded paths – Unmanaged by WSS Code cannot reference WSS Included paths – Managed by WSS Explicit inclusion - Includes the specific path set only Wildcard inclusion – Includes path and all sub-sites eg. http://server/usersites/* Administrative Tools SharePoint Central Administration Web-based UI Command line - stsadm example: stsadm -o addpath -url http://server1/* -type wildcardinclusion Architecture Overview – Managed Paths
8
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 8 Handler filters ASP.Net pages Direct mode - normal page execution Used for SharePoint application pages example: create new list, edit view, etc. Identified by directory ( _layouts ) example: http://mysite/_layouts/1033/create.aspx ) Pages live outside the web without need for customization Safe mode - restricted page execution Only a specific set of web form controls can run Used for SharePoint user pages example home page, list pages, smart pages, topics, etc. Pages live inside the web for customization Architecture Overview – ASP.Net Handler
9
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 9 Application pages (static) Direct mode Page uses SharePoint managed code object model Object model makes calls into WSS unmanaged code User pages (customizable) Safe mode Web part framework adds web parts to ASP.NET page object based on page and current user SharePoint View Web Parts call into SharePoint unmanaged code to render HTML Architecture Overview – ASP.Net Page Rendering
10
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 10 Web Parts are equivalent to ASP.NET Web Form Controls SmartPage - controls on page determined by database URL of the page ID of the current user (personalization) SmartPages work in safe mode only Architecture Overview – Web Part Framework ASP.NET Page Zone 2 Zone 1 Zone 3 Web Part Framework Content DB ASP.NET Page Web Form Controls
11
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 11 Bulk of WSS logic lives in unmanaged code FrontPage server extensions DAV (Distributed Authoring & Viewing) View rendering Static document gets Database I/O Architecture Overview – WSS Unmanaged Code IIS ASP.NET Handler Filter Config Static Pages FrontPage RPC DAV.aspx.asmx HTTP Requests ASP.NET Content SharePoint Unmanaged Code Direct Safe ISAPI Ext ADO.NET Profile Service
12
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 12 Architecture Overview – Developer Perspective Managed Code.NET Object Model Two ways to write code using the WSS OM directly .aspx pages are Direct mode Web parts are Safe mode WSS Web services model built on top of WSS OM available
13
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 13.Net WSS Object Overview – Introduction Managed code object model on the server Accessible via ASP.NET or any other server process Implemented in C# Exposes almost of all of the data stored in WSS 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, i.e. 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 OM
14
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 14.Net WSS Object Overview – Example of Typical Objects List Data SPListCollection SPList SPListItemCollection SPListItem SPFieldCollection SPField SPView Administration SPGlobalAdmin SPQuota SPVirtualServer Security SPGroupCollection SPGroup SPSite SPUserCollection SPUser Documents SPDocumentLibrary SPFileCollection SPFile SPFolder
15
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 15.Net WSS Object Overview – WSS Namespaces Always add references to the WSS namespaces when using WSS OM using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.Administration;
16
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 16.Net WSS Object Overview – Important Objects The object model has four top-level objects: SPWeb - Represents an individual site SPSite - Represents a site collection, which is a set of web sites SPVirtualServer - Represents a virtual server SPGlobalAdmin - Global administration settings Always get an SPWeb object to perform actions on data within a web
17
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 17.Net WSS Object Overview – Key Object - SPWeb Initial object to get at web site Lists, Items, Doc’s, Users, Alerts, etc. Examples: Web.Lists - Returns a collection of lists Web.Title - Returns the title of the site Web.Users - Returns the users on the site In a Web Part or.ASPX page, the following line gets an SPWeb object: SPWeb myweb = SPControl.GetContextWeb(Context);
18
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 18.Net WSS Object Overview – WSS List Data Access Obtain an SPList or SPDocumentLibrary object - SPList mylist = web.Lists[“Events”]; Call the.Items property to retrieve all of the items - SPListItemCollection items = mylist.Items; Call GetItems method and pass SPQuery object for subset of items - SPListItemCollection items = mylist.GetItems(query); Specify field name in SPListItem indexer to get field data – foreach(SPListItem item in items) { Response.Write(item["Due Date"].ToString()); Response.Write(item["Status"].ToString()); Response.WRite(item["Title"].ToString()); }
19
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 19.Net WSS Object Overview – List Data Access Code 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() + " "); }
20
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 20.Net WSS Object Overview – Updating Property Data Immediate data updates are atypical in WSS upon property changes Must first call Update() method on the object Minimization of SQL queries improved overall perfomance Example: SPList mylist = web.Lists[“Tasks”]; mylist.Title=“Tasks!”; mylist.Description=“Description!”; Mylist.Update();
21
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 21.Net WSS Object Overview – Add User to a Web Get the appropriate SPRole object: SPRole admins = web.Roles["Administrator"]; Call the AddUser method: admins.AddUser(“ \\ ",“Joe.User@vitale.com",“J.User","");
22
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 22.Net WSS Object Overview – Eliminate Query Intensive Code Frequently creating and destroying objects may needlessly invoke SQL queries - Example of SQL-intensive code: SPWeb web = SPControl.GetContextWeb(Context); web.Lists["Tasks"].Title="mytitle"; web.Lists["Tasks"].Description="mydescription"; web.Lists["Tasks"].Update(); Example of improved code: SPWeb web = SPControl.GetContextWeb(Context); SPList mylist = web.Lists["Tasks"]; mylist.Title="mytitle"; mylist.Description="mydescription"; mylist.Update();
23
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 23.Net WSS Object Overview – Event Handling Events are supported on document libraries - Operations such as add, update, delete, check-in, check-out, etc. Events are asynchronous Events call a managed interface
24
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 24.Net WSS Object Overview – Part to Part Web Parts Allows Web Parts to send & received basic types of data Cell, Row, List, etc. Uses standardized set of interfaces Allow completely independent parts to connect Enable end users to form connections Browser FrontPage
25
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 25.Net WSS Object Overview – Part to Part Supported Interfaces
26
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 26.Net WSS Object Overview – Web Services Content can be accessed via web services layer built on top of the OM Allows manipulation of Lists, Webs, Views, List Items, etc. Functionality similar to WSS object model with fewer interfaces Optimized to minimize transactions Office 2003 extensively uses web services to access data from WSS
27
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 27.Net WSS Object Overview – Web Services Interface Methods GetListCollection GetListItems GetWebCollection UpdateList UpdateListItems GetWebInfo GetWebPart GetSmartPageDocument etc…
28
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 28.Net WSS Object Overview – Coding Web Services Create a Windows Application In Visual Studio, choose ‘ Add Web Reference ’ Access the lists web service - Enter http:// /_vti_bin/lists.asmx Other services include: UserGroups.asmx – Users and groups Webs.asmx – Web information Views.asmx – View information Subscription.asmx – Subscriptions Send logged on users’ credentials from client Set web reference object’s constructor - public Lists() { this.Url = "http:// /_vti_bin/lists.asmx"; this.Credentials=System.Net.CredentialCache.DefaultCredentials; }
29
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 29.Net WSS Object Overview – Developer Best Practices SPGlobalAdmin and SPSite are the only SharePoint objects created with ‘New’; All other objects are opened off another object The URL taken by the SPSite constructor must be absolute and must refer to the actual computer name (not the load-balanced name) The URL taken by SPSite.OpenWeb can be server relative if it starts with a ‘ / ’ else it is site relative. Empty opens the SPSite URL Optimize performance with foreach() stepping through collections; Iterating through collections by index can result in expensive DB calls Calls to collections such as List.Items are expensive; Preserve the collection rather than requesting it again Use SQL Profiler to minimize # of queries that application makes to DB
30
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 30 Resources Microsoft SharePoint http://www.microsoft.com/sharepoint http://www.microsoft.com/sharepoint Microsoft SharePoint Server Customization http://www.sharepointcustomization.com/resources/webcasts.htm http://www.sharepointcustomization.com/resources/webcasts.htm Microsoft Developer Introduction to Web Parts http://msdn.microsoft.com/library/default.asp?url=/library/en- us/odc_SP2003_ta/html/sharepoint_northwindwebparts.asp Microsoft SQL Server http://microsoft.com/sql/default.asp http://microsoft.com/sql/default.asp
31
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 31 Questions?
32
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Architecture & Object Model Overview 32 VITALE, CATURANO & COMPANY PC
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.