share point - 2007 features

Upload: juan-felipe-maillane

Post on 06-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Share Point - 2007 Features

    1/10

    !!!!

    Based on 5 ratings

    "

    SharePoint 2007 will not only change the way you develop applications for SharePoint, but it will also change the wayASP.NET applications are developed in general. If you doubt that, consider that its predecessor, SharePoint 2003,

    introduced (among other features) the Web Part technology that was later incorporated into ASP.NET 2.0.

    One indication of how this new version dramatically expands SharePoint's already extensive feature set is to note thatthe number of namespaces in the WSS object library has increased by almost a factor of Three (13 namespaces in WSS2.0 vs. 36 in WSS 3.0!) This article is just a sampler, covering 5 of the new or enhanced features that every SharePointdevelop should know about - features that you will want to master to fully benefit from SharePoint 2007.

    #"

    SharePoint 2007 (I use the term here to refer to both Microsoft Office SharePoint Server 2007 and Windows SharePointServices 3.0) will not only change the way you develop in SharePoint, but will change the way ASP.NET applicationsare developed in general. SharePoint 2007 has recently been released but the code with this article was tested with the

    Beta 2 technical refresh. The purpose of this article is to survey what I believe are "must know" new features which willgive you a jump-start in evaluating and mastering the new version.

    Specifically, I will cover:

    Business Data Catalog (Office SharePoint Server 2007 only) Event handler enhancements Extensible workflow Item-level security Simplified web part development using ASP.NET 2.0

    Note: in this article I assume that you are already familiar with the basic features in SharePoint

    2003, and so I won't spend a lot of time explaining what these features are and how they work. Ifyou feel you need more grounding in SharePoint basics there are many excellent books on thesubject, including several titles from Apress ($$"%).

    After reading this article you should be able to explain clearly to your colleagues, management, and clients how thesenew features fit into your overall SharePoint and ASP.NET 2.0 deployment strategy.

    %&'%

    Although this article doesn't address programming against SharePoint, you will probably want to obtain a copy of thesoftware to try it out for yourself. For most of the topics covered you only need Microsoft Windows Server 2003(Standard or Enterprise) and WSS 3.0, not MOSS 2007 - which runs on top of WSS 3.0

    As part of the WSS 3.0 installation process the following components will be installed:

    Page 1 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    2/10

    .NET 2.0 or .NET 3.0 SQL Server 2005 Express Edition (if you already have SQL Server 2005 you can use that rather than the

    "Express" edition) Windows Workflow Foundation beta

    If you plan to create custom web parts or .NET applications that access the object model you will also want to installVisual Studio 2005.

    ()*

    If your firm is like mine, one of the first things you did (or want to do) with SharePoint is to present an integrated view ofdata from the many disparate systems that store bits and pieces of your business' data. SharePoint can be a great tool forbringing together financial, client relationship, document management, and workflow systems into a single unified view.To achieve this goal you must extract the data from each of the source systems and convert it ultimately into HTML thatcan be displayed on the page. The Business Data Catalog (BDC) feature of MOSS 2007 attempts to address this commonneed by creating a metadata catalog that commercial software vendors and in-house developers can use to storeinformation about data sources. Microsoft also provides a set of basic web parts that non-technical users can configure toquery, display, and connect data sources defined in the BDC.

    Note: the Business Data Catalog is a feature of Microsoft Office SharePoint Server 2007, and willnot be available if you only install Windows SharePoint Services 3.0.

    To provide a simple example of how the BDC is configured and used, I will create a simple SQL Server table, register itin the BDC, and display it on a web part page using one of the BDC web parts provided by Microsoft.

    First, I'll create a BDC definition for a simple SQL Server table shown in *+:

    Figure 1. Sample database table used to demonstrate BDCThis figure has been reduced in size to fit in the text. To view the full image )"

    By way of an example I include a fragment of a BDC schema for the above data source. The schema XML is read bySharePoint to create the definition of the data source that can be used by the BDC web parts or BDC classes in the objectmodel.

    Page 2 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    3/10

    %

    PassThrough

    SELECT ID,Name,Notes from Table_1 where Name LIKE @Name

    True

    The above listing is incomplete, but it gives you a sense of the challenge inherent in defining even a simple schema. Thisdifficulty notwithstanding, Microsoft and others will undoubtedly create GUI schema designers to produce the necessaryXML. In the meantime, Microsoft provides an XML schema file (.XSD) to help us pioneers create schemas using just

    Visual Studio 2005. * shows the BDC in action using the built-in BDC list web part.

    Page 3 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    4/10

    Figure 2. The BDC list web partThis figure has been reduced in size to fit in the text. To view the full image )"

    While this example is absurdly simple, you can imagine creating (or purchasing) a library of schemas for both customand commercial applications that allow your users to easily query and display data from a variety of systems. I don'tdoubt that, in many firms, the BDC will become one of the most valuable features of Office SharePoint Server 2007.

    ,

    In SharePoint 2003 only document and form libraries supported custom event handlers, and only a very limited set atthat. In SharePoint 2007 all list types support an expanded set of events. This expansion in event handling willundoubtedly lead to a dramatic increase in the use of SharePoint 2007 as a business workflow platform. The followingtable lists the workflow events to which you can attach handlers in SharePoint 2003 and will be available in SharePoint2007 when released:

    Note the two types of events: asynchronousasynchronousasynchronousasynchronous and synchronoussynchronoussynchronoussynchronous. Microsoft defines synchronous list events are those thatoccur beforebeforebeforebefore an action is taken (e.g. deleting a list item). In such a case your event handler must complete prior to thetriggering action and you have the option of canceling that action. For example, you could determine that based on somebusiness rules, that a user's updates to a list are invalid and should not be applied. You now have the ability to canceltheir updates and display an error message. SharePoint 2003 only provided asynchronous events that fired after the action

    has occurred, thus requiring awkward workarounds in code if the action preceding the event needed to be cancelled.

    To code a SharePoint 2007 event handler in .NET, you create a server control class that implements theSPItemEventReceiver interface. Writing your event handler is fairly straightforward as the overridable methods in theSPItemEventReceiver interface expose the list item on which the event occurred, so you can manipulate it using other

    SharePoint or standard .NET classes and methods. As with SharePoint 2003, your event handler must be strongly namedand reside in the GAC.

    While SharePoint 2007 events can be registered using the same procedure used in SharePoint 2003, Microsoftrecommends a new approach that utilizes FeaturesFeaturesFeaturesFeatures, which are a declarative model for defining extensions to SharePoint.With this approach you first define the feature using XML, as shown below.

    EventEventEventEvent SharePoint 2003SharePoint 2003SharePoint 2003SharePoint 2003 SharePoint 2007SharePoint 2007SharePoint 2007SharePoint 2007 TypeTypeTypeType

    Before item is added No All list types Synchronous

    After item is added Document and forms libraries only All list types Asynchronous

    Before item is changed No All list types Synchronous

    After item is added Document and forms libraries only All list types Asynchronous

    Before item is deleted No All list types Synchronous

    After item is deleted Document and forms libraries only All list types Asynchronous

    Page 4 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    5/10

    Note: This example draws on sample code from the SDK.

    Then you define ElementsElementsElementsElements of the feature, such as,

    DeletingEventHandler

    ItemDeleting

    10000

    DeletingEventHandler, Version=1.0.0.0, Culture=neutral,

    PublicKeyToken=a26b5449ac4a4cf3

    DeletingEventHandler.DeletingAction

    These definition files are then imported into SharePoint and associated with one or more lists.

    Note: There are also events that fire before sites or site collections are deleted, allowing you toensure proper archiving of sites.

    -./

    Picking up where custom event handlers leave off, SharePoint 2007 supports complex workflow processes using the newWindows Workflow Foundation. You can author workflows in either Visual Studio 2005 or SharePoint Designer 2007

    (the new name for FrontPage). Not surprisingly, creating workflows is simpler in SharePoint Designer, but you havemuch more flexibility and control in Visual Studio.

    *0 gives you a sense of how workflows are defined in SharePoint Designer 2007. The process is essentially a fill-in-the-blanks affair, which makes it simple to get started.

    Page 5 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    6/10

    Figure 3. Defining a workflow in SharePoint Designer 2007

    After the workflow above has been saved in SharePoint Designer (and automatically deployed to a SharePoint site), itwill check the field any time a document is added or modified. If the text is found the workflowengine will change it to .

    What Microsoft and many others have observed is that application development can benefit by separating the flow-of-

    control logic (i.e workflow) from the code that gets executed at each flow state (i.e. activities). You will see thisapproach begin to permeate all .NET development, not just SharePoint.

    #%1"

    This enhancement moves SharePoint closer to the realm of true document management systems (a fact that is not lost onDMS vendors). In SharePoint 2007 you will be able to set permissions on a list, a folder, or on individual documents. Incontrast SharePoint 2003 lists only supported security at the list level. Combined with the new security trimming feature,which hides list items from users who don't have permissions to access them, SharePoint 2007 provides a basic butserviceable DMS. Considering that the cost of a mid-range DMS system starts at several hundred thousand dollars, manyfirms may seriously consider SharePoint 2007 as their only DMS platform.

    As *2 shows, the context menu for individual list items now allows you to set permissions (and alerts) for justthat item. For practical reasons you probably want to use this feature sparingly, as security administration could becomea real burden if most of your documents have unique permissions, but the addition of this capability will answer many

    Page 6 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    7/10

    objections that have been raised against using SharePoint as a general-purpose document management solution.

    Figure 4. Setting individual list item permissions in SharePoint 2007This figure has been reduced in size to fit in the text. To view the full image )"

    %/.%*$3

    $

    In SharePoint 2003 creating your first web part was a true right of passage. Especially in the early days just after itsrelease, with little documentation and no Visual Studio templates the process was an exercise in patience. SharePoint2007, on the other hand, makes creating web parts almost easy! This is due to the fact that SharePoint 2007 is based onASP.NET 2.0 from the ground up, and so native ASP.NET web parts can be deployed to SharePoint.

    Note: SharePoint 2003 style web parts are still supported by SharePoint 2007. However, you shouldconsider utilizing ASP.NET 2.0/3.0 web parts both for their better performance and to ensurecompatibility with future versions of SharePoint.

    %/).

    Step 1: Create the server control based on the ASP.NET 2.0.

    Imports System.Web

    Imports System.Web.UI

    Imports System.Web.UI.WebControls

    Imports System.Web.UI.WebControls.WebPartsPublic Class HelloWorld

    Inherits WebPart

    Private _text As String

    Page 7 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    8/10

    _

    Public Property Text() As String

    Get

    Return _text

    End Get

    Set(ByVal value As String)

    _text = value

    End Set

    End Property

    Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)writer.Write("HelloWolrld! " & Text & "from" & _

    context.User.Identity.Name "")

    End Sub

    End Class

    Note that the above code imports the . library (i.e. the standard .NET 2.0 classlibrary), rather than the Microsoft.SharePoint library used in SharePoint 2003.

    Step 2: Compile to folder under SharePoint root folder (if folder doesn't exist you can create it)

    Step 3: Edit the SharePoint file to include a SafeControls entry for the new web part, specifying theAssembly

    ,Namespace

    ,TypeName

    of the web part to import. If you want to include all web parts in the specifiedAssembly and Namespace then you can specify as a TypeName as I have here:

    Step 4: Add the web part to the .

    Page 8 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    9/10

    Figure 5. Add the web part to the SharePoint web part gallery

    Step 5: Place the web part on the page.

    If you've built a web part for SharePoint 2003 you can see the process has been significantly streamlined! It will not onlysubtly change the cost/benefit calculation when deciding whether to create a web part from scratch, use a wrapper suchas the , or simply use the web part to display a stand-alone application, but make it easier fornovice web part programmers to get started.

    )"

    In this article you've learned about a few of the new features that have made my "top 10" list for SharePoint (my "top 5"to be precise).

    While the BDC may not be the answer to all of your data integration woes, Microsoft deserves high marks for making anattempt to provide a common metadata repository and framework for accessing external data sources through SharePoint.The expanded event handling is certain to spawn numerous new uses for SharePoint as commercial vendors and in-house

    developers merge business logic with document libraries and lists. Windows Workflow Foundation will move yourapplications development in to an entirely new dimension - that of time - allowing you to create business logic thatintegrates SharePoint data and documents with sophisticated workflows. The addition of item-level security continues toerode the distinction between SharePoint and traditional document management (DM) systems. Last, but certainly not

    Page 9 of 10ASP Today Printer Friendly

    4/24/2007http://www.asptoday.com/ContentPrinterFriendly.aspx?id=2448

  • 8/2/2019 Share Point - 2007 Features

    10/10

    least, a significantly simplified web part creation and deployment process will save you countless hours and expand theranks of programmers able to create web part solutions. While these 5 features represent just a tiny fraction of what's newin SharePoint 2007, taken together they represent a quantum leap in what you can accomplish by building yourapplications on this platform!

    Whether you're a .NET developer new to SharePoint, or a seasoned SharePoint pro, you'll definitely want to explorethese on your own, as well as look for future articles on these and other SharePoint topics in ASP Today.

    ASPToday - 2003-2005 Apress You may print a copy of this article for easier reading or reference, or store thedownloaded HTML page on your local machine for your own use. Please check the Terms and Conditions on the ASPToday website for full details of the conditions for distributing this article.

    Page 10 of 10ASP Today Printer Friendly