Presentation is loading. Please wait.

Presentation is loading. Please wait.

June 4-8 Orlando. WSS Object Model Fundamentals Working Remotely with Lists and Document Libraries Cross-Site Data Queries Exploring New WSS Classes.

Similar presentations

Presentation on theme: "June 4-8 Orlando. WSS Object Model Fundamentals Working Remotely with Lists and Document Libraries Cross-Site Data Queries Exploring New WSS Classes."— Presentation transcript:

1 June 4-8 Orlando



4 WSS Object Model Fundamentals Working Remotely with Lists and Document Libraries Cross-Site Data Queries Exploring New WSS Classes Event Handlers

5 WSS 3.0MOSS 2007 Microsoft.SharePoint.dllMicrosoft.Office.Server.dll Microsoft.Office.Server.Publishing.dll Microsoft.Office.Server.Policy.dll Microsoft.Office.Server.Search.dll Microsoft.SharePoint.Portal.dll Microsoft.Office.Workflow.Tasks.dll Microsoft.SharePoint.Publishing.dll Microsoft.SharePoint.Workflow.Actions.dll There is also the.NET Reflector on Download the SDK!!!!

6 WSS Sites WSS Object Model Web Parts Web Pages Smart Clients Web Parts Web Pages Smart Clients Smart and Mobile Clients Web Services Web Parts ASP.NET Custom Controls and User Controls Application pages Feature activation event handlers Event handlers for lists, doc libs, sites & site collections ASP.NET applications and Web services Windows Forms and Console applications

7 High Backward Compatibility With WSS v2 Some classes are obsolote -SPGlobalConfig -SPVirtualServer High Backward Compatibility With WSS v2 Some classes are obsolote -SPGlobalConfig -SPVirtualServer SPWebServer SPWebApplication SPSite SPWeb SPList SPListItem SPFarm

8 Represents site collection User must be authenticated and authorized unless anonymous access is enabled Site Collection has an owner Site Collection contains hierarchy of child site

9 Sites accessible through SPWeb objects Often must use SPSite object to access SPWeb objects

10 Many WSS OM objects follow IDisposable pattern They use unmanaged resources that must be released Failure to call Dispose can cause serious memory leakage

11 Lists are modeled using SPList objects Items modeled using SPListItem objects Document libraries can be accessed using SPList

12 Site represents hierarchy of files and folders Files represented through SPFile objects Folders represented through SPFolder objects What can be done? Discover all files and folders within a site Add, move, copy, delete files and folders Return a page to its initial ghosted state Program against Web Part data on a Web Part Page

13 Document Library is more than a SPList object Can convert SPList to SPDocumentLibrary Make extra functionality accessible


15 Impersonating using the SPSite constructor Elevating Privileges The ISecurableObject Interface Dont forget: Test your Web Parts with the least security permissions!

16 Web Part code is executed with the account of the logged- on user Impersonation done by SharePoint Handle this elegantly!

17 Constructor of SPSite accepts now an SPUserToken used to impersonate a specific user Tokens time out after 24 hours Web Part requires SharePointPermission with Impersonate option

18 Some aspects of WSS OM require privileged users Run your code with the SharePoint\System account Use with care! The behavior has been created by design (not a mistake!) SPSecurity.RunWithElevatedPrivileges solves many problems Web Parts must have the SharePointPermission to execute this code Seal your Web Part!

19 Everybody doing security implements this interface SPWeb, SPList, SPListItem



22 CAML = Collaborative Application Markup Language Used in SharePoint for Definition of the Sites, Lists and Views Querying of SharePoint content Executing CAML Queries SPQuery SPSiteDataQuery Lists.asmx


24 Remotely view and edit SharePoint List data http://[server]/_vti_bin/Lists.asmx Operations available: Work with Document Libraries using FrontPage RPC AddAttachment UpdateList DeleteList UpdateListItems GetAttachmentCollection AddList GetListItemChanges GetListAndView GetList GetListCollection GetListItems DeleteAttachment


26 What is an event handlers? An event handler is a.NET assembly containing one or more classes handling events that are triggered by SharePoint WSS v2 only possible for document libraries executed in an asynchronous manner WSS v3 events architecture significantly improved Scope has been extended: lists, document libraries, content types, site, site collection Events supported for incoming email messages Support for synchronous events and asynchronous events Synchronous events occur before the fact and are cancel-able Events are used in other scenarios Custom policies Features

27 ScopeDescriptionBase Class Item in a list or library Actions users can do in a list include adding, modifying, deleting, check-in and check-out,... SPItemEventReceiver List or libraryTrap changes to entities of list schema events, supporting list schema operations and the addition or removal of content types. SPListEventReceiver WebEvents fired at the level of the site (e.g. adding and removing sites, creating and deleting lists) SPWebEventReceiver EmailProvides a method for trapping the event when a list receives an e-mail message (EmailReceived) SPEmailEventReceiver FeatureTrap the activation, deactivation, installation, or uninstallation of a Feature SPFeatureReceiver

28 .NET class library Reference to Microsoft.SharePoint.dll Custom class inheriting a WSS receiver class Override base methods using Microsoft.SharePoint; namespace Demos { public class MyEventHandler: SPItemEventReceiver { public override void ItemDeleting(SPItemEventProperties properties) { // do something and possibly cancel the event properties.Cancel = true; properties.ErrorMessage = my message"; } public override void ItemDeleted(SPItemEventProperties properties) { // do something }

29 Compile class into strong-named assembly Deploy the DLL in GAC Register DLL as event handler in WSS v3 The WSS v2 way (only for document libraries) Programmatically via the object model Using the new WSS feature framework


31 Navigation Content Types Recycle Bin Versioning Workflow

32 WSS Navigation is extensible Add nodes through WSS UI Adds nodes through code

33 SPContentTypeCollection SPContentType SPContentTypeId SPFieldLinkCollection SPFieldLink SPXmlDocumentCollection

34 WSS provides rich auditing support But doesn't make auditing usable OOB - you need MOSS Custom development required to make WSS auditing functional enable auditing using code now examine what's in WSS audit log


36 WSS exposes a very rich object model Dont forget to clean up your WSS v2 code a bit And do call Dispose() Many improvements have been done to remove the many issues regarding security and SharePoint programming Impersonation is more elegant Common interface for objects that support ACLs Web Services are your way of getting acces to SharePoint remotely Event handlers are now a major extensibility option Many many new classes.. And wait till youve seen the MOSS object models

37 Q&A

38 Breakout Sessions Session Codes and Titles Chalk-Talks Session Codes and Titles Instructor-led Labs Session Codes and Titles Hands-on Labs Hands-on Lab Codes and Titles

39 Technical Communities, Webcasts, Blogs, Chats & User Groups Microsoft Developer Network (MSDN) & TechNet Trial Software and Virtual Labs Microsoft Learning and Certification Required slide

40 Complete an evaluation on CommNet and enter to win! Required slide

41 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Download ppt "June 4-8 Orlando. WSS Object Model Fundamentals Working Remotely with Lists and Document Libraries Cross-Site Data Queries Exploring New WSS Classes."

Similar presentations

Ads by Google