WF in SharePoint Server 2010

October 22nd, 2009 Peter Plessers Comments off

Microsoft has decided to base SharePoint Server 2010 on .NET 3.5 instead of the to-be-released 4.0 version of .NET. Concerning workflow development with WF in SharePoint, this means that it pretty much remains the same (unless you are using SharePoint designer, but that is another story). The positive aspect of this is that the migration of existing workflows from a SharePoint 2007 to a SharePoint 2010 should be fairly painless. The downside is that we can’t make use of all te new goodies the WF rewrite in .NET 4.0 provides (new workflow designer, support for flow chart workflows, …). So while the rest of the .NET world moves on, we will be left behind with old-school workflow technology. Ok, this might be a little bit exaggerated ;-)

Does this means that there is nothing new regarding workflow development in SharePoint Server 2010? Nope, there are a few interesting changes. First of all, there is no support for so called site workflows. In SharePoint 2007, one had only the possibility to run workflows on a list item. For scenarios where you required a workflow that didn’t have a link with a list item or document, SharePoint 2007 wasn’t really a great fit. You ended up either using a kind of dummy list or decided to move these workflows outside of SharePoint. This is no longer necessary with SharePoint Server 2010 as it supports workflows that are associated with sites instead of lists or content types.

Another chance is that Microsoft has opened up the workflow runtime in SharePoint Server 2010. This means that we finally can add our own custom HandleExternalEventActivity en CallExternalMethodActivity. No more hacking with dummy tasks to communicate between a workflow and external systems.

A last change is support for workflow events. A new class called SPWorkflowEventReceiver has been added to SharePoint Server 2010. This class allows to execute custom code a certain workflow events and is in that sense similar to the other event receivers in SharePoint. The workflow events that are supported are the following:

  • Starting
  • Started
  • Postponed
  • Completed
Categories: SharePoint conference 2009 Tags:

Developing with the new UI Features

October 22nd, 2009 Karine Bosch Comments off

Custom application pages

Custom Application pages now use the DynamicMasterPageFile attribute. This enables application pages to use the master page of the site from which they are accessed.

<@Page language="C#" DynamicMasterPageFile="~masterurl/default.master"
      title="Demo Page" inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" />

The ribbon

The ribbon is now used everywhere in SharePoint replacing the CustomActions.

ribbon2

It has a fixed position at the top of the page. It is based on the Contextual tab model.

CustomActions  are backward compatible and will show up in the ribbon.

The super tooltip

tooltip

Extending the ribbon

 You can extend the ribbon with buttons, drop downs, flyout menus, toggle buttons, etc.

Button, groups and tabs are defined in XML and execute asynchronous JavaScript. Buttons having simple behavior can defined declaratively, buttons having a more complex behavior require a JavaScript Page Component.

The OOB ribbons are defined in the CMDUI.XML stored in the 14\TEMPLATE\GLOBAL\XML directory. You can declare your own buttons using a CustomAction.

<CustomAction
         Location=(somewhere in ribbon)
        Scope = (Farm to Web)>
        <CommandUIExtension>
             <CommandUIDefinitions />
             <CommandUIHandlers />
        </CommandUIExtension>
</CustomAction>

Define your buttons in the CommandUIDefinitions section.

<CommandUIDefinition
      Location="Ribbon.WikiPageTab.Groups._children">
      <Group
         Id="Ribbon.WikiPageTab.CustomGroup"
         Sequence="55"
         Description="Custom Group"
         Title="Custom Group"
         Command="EnableCustomGroup"
         Template="Ribbon.Templates.Flexible2">
         <Controls Id="Ribbon.WikiPageTab.CustomGroup.Controls">
            <Button
                Id="Ribbon.WikiPageTab.CustomGroup.Controls.CustomButton1"
                Command="CustomButtonCommand1"
                Image16by16="/_layouts/images/FILMSTRP.GIF"
                Image32by32="/_layouts/images/PPEOPLE.GIF"
                LabelText=""
                TemplateAlias="o2"
                Sequence="15" />
         </Controls>
      </Group>
</CommandUIDefinition>

The Javascript that needs to be executed by the button click needs to be added to the CommandUIHandlers.

<CommandUIHandler Command="CustomButtonCommand1" CommandAction="javascript:alert('Hello, world!');" />

The Status Bar and the Notification Area

The status bar is meant to give the user information in context without distracting hem/her. The Status bar should be used to display persistent information such as page status or version. The notification area can be used for messages. By default a message shows up during 3 seconds.

status bar and notification

Extending the Status Bar

There is a JavaScript API to add/remove messages and specify the message color. The message itself consists of HTML and can include links and icons. A status can have 1 to 4 different colors depending on the importance of the message.

SP.UI.Status.addStatus
SP.UI.Status.updateStatus
SP.UI.setStatusPriColor

Extending the Notifications Area

There is a JavaScript API to add/remove messages. The message itself consists of HTML and can include links and icons.

SP.UI.Notify.addNotification

The Dialog Framework

Reduces page transitions and keeps the user in context. The content of the dialog loads in a  IFRAME inside a floating div. Dialogs are modal and can be maximized to size of the browser window.

There is a JavaScript API to control dialogs. The contents can be a page (URL) or DOMElement. Optional parameters can be specified to set title, width, height, and whether or not to launch maximized.

You can design a page that can both be used as page or displayed inside a dialog. You can set the CSS class to “s4-notdlg”  to hide the UI behind the dialog.

There is also a JavaScript API to handle dialogs:

SP.UI.ModalDialog.showModalDialog (options)

New Theming Engine

The New Theming Engine is designed to let you easily create your own themes. It uses the *.thmx file format that can be generated by client Office programs. For example, if you like the theming of a powerpoint presentation, you can easily save that theme as a .thmx file and upload it in the Theme Gallery.

The engine automatically generates new CSS for each theme when it is applied.

You can have your controls on application pages themed.

  • create a SharePoint project in Visual Studio 2010
  • add a mapped folder Themable
  • place styles in .css
  • Add attributes this way
      /* [ReplaceColor(themeColor: "Light1")] */
      background-color:#ffff

to make it possible for the theming engine to apply the style of the theme

Remark: changes will only apply be reselecting the theme.

Thank you Elizabeth Olson for this clear and inspiring presentation!

Categories: SharePoint conference 2009 Tags:

Search and you’ll find…

October 21st, 2009 Peter Plessers Comments off

SharePoint Server 2010 Search

The search capabilities of SharePoint Server 2010 show a number of improvements compared to its predecessor. Besides promised enhancements to the relevance ranking algorithm, better support for foreign languages, etc., a number of interesting new features appear:

  • Search refinements allow users to further drill-down the search results by applying additional filters. Examples of refinements include searching by type of content (e.g., show me only presentations, or only documents), location of the content (by selecting a specific site), author (show me only content created by a selected user), last modified date (e.g., show me only content that was modified in the last 6 months), … SharePoint automatically determines which refinements to show based on the actual search results set.
  • Wild-card search (Yeah, baby!).
  • SharePoint will also show a list of other related searches based on your query.
  • SharePoint will popup a list of query suggestions while you type in your search query. This feature is quite similar to what for example Google provides in its search engine.

FAST Search for SharePoint 2010

FAST Search for SharePoint 2010, a new product that will be introduced along with SharePoint Server 2010, provides a number of additional features on top of the out-of-the-box search capabilities of SharePoint Server 2010. Some of the directly visible features include:

  • Thumbnails & previews. SharePoint shows a thumbnail of documents in the search result. It even provides a preview of documents, which allows users to scroll through the contents of a document directly from within the search results (e.g., scrolling through all slides of a presentation) so that i becomes much easier to find the correct document.
  • Property extractors. The FAST search engine can automatically extract metadata from the contents of documents using property extractors. Out-of-the-box, FAST is able to identify names of people, places, organizations, dates, times and email addresses. Custom property extractors can be added. The extracted metadata can be internally used by SharePoint to provide additional search refinements.
Categories: SharePoint conference 2009 Tags:

Sandboxed solutions

October 21st, 2009 Karine Bosch Comments off

Sandboxed solutions cannot be uploaded and deployed to a SharePoint site by a user or a developer. You need administrator rights to deploy a sandboxed solution to a SharePoint site collection. It will run in an environment that has access to a subset of the server object model. The farm administrator can set usage limits and resource limits to protect the SharePoint server. Sandboxed solutions run in a separate process. All sandboxed solutions have detailed monitoring via the Central Administration.

Visual Studio 2010

When creating a SharePoint solution using the Visual Studio project templates, you will be asked if you are going to create a full-trusted solution or a sandboxed solution.

What can you develop with sandboxed solutions?

  • content types
  • custom actions
  • declarative workflows
  • event receivers
  • feature receivers
  • list definitions
  • non-visual web parts
  • site pages

Solution Gallery

  • document library for SharePoint Sandboxed solutions
  • Site Collection administrators can choose witch solutions are needed.
  • Resource quotas can loc down the amount of server resources a solution can use.

Location

The binaries of a sandboxed solution are stored in the 14\UserCode folder. This folder also contains a web.config where the reference to the CAS policies need to be added.

Code Access Security

CAS policies allows a solution assembly to load and use the SharePoint object model. Due to the CAS a sandboxed solution cannot access any resource outside the Sandbox. The AssemblyInfo.cs file contains a [assembly:AllowPartiallyTrustedCallers] attribute.

There is a API Blocklist giving the farm administrator the possibility to further lock down the APIs that can be used.

Full-Trust proxy

This is a way to break out to do more in your SharePoint solutions. It is a fully trusted piece of code that you can call from within your application. It is just a specific task that can be executed.

You can create your own full-trust proxies by creating  a number of classes:

  • a class that inherits from SPProxyOperation. This class will be used to execute operations that normally are prevented for sandboxed solutions. This is deployed to the Global Assembly Cache.
  • create a class that inherits from SPProxyOperationArgs. This class will be passed to the Execute method of the SPProxyOperation class. It is also deployed to the Global Assembly Cache.

You have to register those classed in SharePoint. You can then call this class that inherits from SPProxyOperation from within your sandboxed solution.

Solution Validation

Administrators can block solutions. They can create a Solution Validation object that interrogates the solutions. Solution validators inherit from SPSolutionValidator. By overriding the ValidateSolution and the ValidateAssembly methods, administrators can validate solution packages and assemblies in the solution packages. These methods execute only one time for each solution package. These solution validators need to be deployed as Farm-level solutions.

Solution Monitoring

Administrators can monitor the resources that are used by the sandboxed solutions. When a solution uses to many resources, it will be stopped. This way an administrator can identify expensive solutions.

Categories: SharePoint conference 2009 Tags:

Developing SharePoint 2010 Applications with the Client Object Model

October 21st, 2009 Karine Bosch Comments off

Besides the Server object model, SharePoint 2010 also comes with a Client Object Model. In fact, not 1 client OM but 3!

  • .NET Managed client object model
  • ECMAScript client object model
  • Silverlight client object model

They are all light-weight versions of the server API. The new object models are designed to minimize the number of round trips that must be implemented for common actions. The object models provide a consistent and easy-to-use, object-oriented system for interoperating with SharePoint data from a remote client or server.

In each client object model, the ClientContext object serves as the main entry point for accessing the client object model.

ClientContext clientctx = new ClientContext(http://yoursharepointsite);

As of then you have to load the objects you need from the server:

SPWeb web = clientctx.web;
clientctx.Load(web);
clientctx.ExecuteQuery();

.NET Managed Client Object Model

This object model can be used for applications running outside the SharePoint context on remote machines. It can be used from within Windows Presentation Foundation (WCF) applications and client office applications like Word or Outlook. This is a simple API to add, retrieve, update and delete data.

Assemblies:

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.ClientRuntime.dll

Locations of the assemblies:

  • 14\TEMPLATE\WebClients

Size:

  • 281 kb + 145 kb (pritty small taking into account that the server object model takes up to 15.3 MB).

ECMAScript Client Object Model

This object model is designed for use from within Javascript and JQuery. To be able to use this client object model you have to place a ScriptLink control on the page, f.e. in the Main content placeholder:

<SharePoint:ScriptLink ID="MyScriptLink" Name="sp.js" LoadAfterUI="true" Localizable="false" />

Javascript as the following can then be placed on the page:

<script type="text/javascript">
    function onQuerySucceeded(sender, args) {
        alert('Title: ' + this.oWebsite.get_title() + ' Decription: ' + this.oWebsite.get_description());
    }
    function onQueryFailed(sender, args) {
        alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
    }

    function retrieveWebSite() {
        var clientContext = new SP.ClientContext.get_current();
        this.oWebsite = clientContext.get_web();
        clientContext.load(this.oWebsite);
        clientContext.executeQuery(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    }
</script>

Javascript files:

  • sp.js
  • sp.debug.js
  • sp.core.js
  • sp.core.debug.js

Locations of the files:

  • 14\TEMPLATE\LAYOUTS\

Size:

  • 380 kb (sp.js) + 559 kb (sp.debug.js)

Silverlight Client Object Model

This object model is designed for use from within Silverlight applications. As with the other client object models you have to initialize an instance of the ClientContext object. Calls to SharePoint run asynchronously and on different threads so you have to specify an callback handler for the ClientRequestSucceeded event handler and the ClientRequestFailed event handler.

Assemblies:

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

Locations of the assemblies:

  • 14\TEMPLATE\LAYOUTS\ClientBin

Size:

  • 262 kb + 138 kb
  • Categories: SharePoint conference 2009 Tags:

    SharePoint 2010 as a Development Platform

    October 21st, 2009 Karine Bosch 1 comment

    This was the first session I followed right after the keynote. It’s all about the new development possibilities that comes with SharePoint 2010.

    Business Connectivity Services and External Content Types

    Business Connectivity Services (BCS) is the replacement for Business Data Catalog (BDC). This service gives you the possibility to connect to external datasources. SharePoint Designer 2010 offers a brand-new designer to design the different entities and their relations. This makes it possible to define external content types. This will be explained in another session followed by Peter.

    List Improvements

    When you create a Lookup field, which is a field based on data in another SharePoint list, you can define to view more than 1 column from the related list. 

    lookupfield

    And yes! You can now define relationships between SharePoint lists. This also means that you can define cascading deletes or ask for confirmation before a parent list item is deleted (Restrict Delete option).

    relationship

    Other important List improvements are:

    • List Index auto creation
    • List Query Throttling, which means that an admin can set a limit on the number of rows in a view
    • Views are now build on XSLT instead of CAML

    This doesn’t mean that CAML is dead. CAML is still needed when quering SharePoint from within the Client Object Model.

    Events improvement

    The range of events for which you can define event receivers is now extended with

    • Site-scoped events
    • after-synchronous events
    • Web Creation events
    • List Creation events

    Workflow improvements

    • Workflow Designer in SharePoint Designer
    • Visio 2010 Workflow Design
    • Import Workflow from SharePoint Designer into Visual Studio 2010
    • Visual Studio 2010 Initiation Form and Association Form

    Accessing Data in Lists

    A lot of new possibilities are offered

    • Server Object Model (as we have now)
    • Client Object Modes that run on the desktop
    • REST API’s
    • LINQ and all its possibilities:�
      • Supports Joins and Projections
      • Will dramatically reduce run time errors, moving them to compile time

    Client Object Models

    There are 3 different client object models:

    • .NET client object model for use from within WPF or office development
    • Javascript client object model
    • Silverlight client object model

    The Ribbon

    You can find the ribbon now all over the place. Every single action on a site, page, list or document library offers a ribbon with tabs, contextual tabs and ribbon buttons. The buttons work with client-side custom actions.

    ribbon

    The ribbon is extensible, meaning that you are able to add your own groups and buttons to the ribbon. How this works will be explained by Elizabeth Olson in one of the upcoming sessions. I’ll be there!

    Besides a ribbon SharePoint 2010 also comes with

    • a Status bar
    • a notification area
    • a Dialog Framework

    Also these parts are extensible.

    Sandboxed solutions

    Sandboxed solutions look for a balance between security, stability and business agility. When creating a SharePoint solution in Visual Studio 2010 your are asked if you want to create a full-trusted solution or a sandboxed solution. Visual Studio has an alternative deployment configuration for sandboxed solutions.

    Sandboxed solutions are:

    • Site-collection based
    • Limited API access
    • Cannot be uploaded to the SharePoint Solution Gallery
    • Can be uploaded to SharePoint Online
    • Monitored resources (When a solution runs too long or takes up too many resources, it will be killed).
    • Runs in different process
    • Logged in job history

    SharePoint Online 2010

    • Allows uploading and running sandboxed solutions
    • Supports Business Connectivity Services (BCS)

    SharePoint Online 2010 becomes a development platform!

    Silverlight 3 integration

    SharePoint 2010 provides a Silverlight Webpart which is a wrapper web part in which you can host any Silverlight application. You only have to configure the location of the .xap file and eventual initparameters. There is also a very good looking Media Web Part available.

    Besides that, Silverlight is used for different dialogs within SharePoint 2010. One of the examples are the dialogs that are presented when creating a list/document library or a site.

    As already mentioned, there is also a Client Object Model for use from within Silverlight 3.

    SharePoint 2010 Developer Dashboard

    When your solution is deployed, you can click a button on the right of the navigation bar to view status information on call stack on the Developer Dashboard directly in your SharePoint site.

    You will see information on:

    •  the request/response cycle and how much time each operation took. As a developer you can learn important lessons from these time results.
    • the response time that each database query took.
    • And last but not least the load times each Web part on the page took.

    The following picture is taken from Bob Fox’s post on the SharePoint Developer Dashboard. You can read more about the Developer Dashboard here. developer dashboard

    SharePoint Designer 2010

    This tool is still alive and kicking and is much ameliorated. There are a number of new designers in SharePoint Designer 2010:

    • Workflow Designer
    • Business Connectivity Designer

    SharePoint Designer 2010 will also be more integrated with Visual Studio. You can for example import a .WSP solution package and work with the content of it.

    Upgrade and Packaging

    There is now a visual upgrade available for version to version upgrade. There are also better upgrade sementics offering declarative upgrade mappings.

    Team Foundation Server

    We will finally be able to do decent source control management

    • Work item tracking
    • Source code control
    • Nightly builds
    • Code Analysis
    Categories: SharePoint conference 2009 Tags:

    First day @ the SharePoint Conference 2009

    October 20th, 2009 Karine Bosch Comments off

    Print 

    The conference started with the Keynote. No in fact the conference started with the rush to the breakfast area: 7000 hungry SharePoint developers and IT Pros in need for a sandwich and a coffee. Now the more serious stuff. The keynote by Steven Ballmer, Tom Rizzo and Jeff Taper was splendid: you could feel the excitement rise among the attendees when they showed off feature after feature.

    Steve Ballmer announced that the beta version of SharePoint 2010 will be released somewhere in November 2009. SharePoint Designer contains a set of new features and designers and will remain free in the 2010 version. SharePoint Online will become available for internet facing sites.

    Tom Rizzo showed of the new Visual Studio 2010 Tools for SharePoint. There will be SharePoint project templates available for each type of feature: web parts, custom fields, list definitions, event handlers etc. More on this in the posts to come. Visual web parts have a user control that can be designed from within Visual Studio 2010. No more building the user interface in code! Silverlight is also highly integrated in SharePoint 2010. When you create a list or a site, the dialogs for selecting the appropriate template are all Silverlight.

    Jeff Taper announced that the product with code name Gemini becomes PowerPivot 2010: 100.000.000 rows in Excel can be published to the server in a blink of the eye. You can find more information on it here (http://www.powerpivot.com/)

    During lunch Peter and I agreed to follow as many different sessions as possible in order to get a good idea of what SharePoint 2010 has to offer. I have the feeling that this will be a promising week.

    Categories: SharePoint conference 2009 Tags:

    Visio services

    October 20th, 2009 Peter Plessers Comments off

    One of the great new features of SharePoint 2010 is Visio services. Similar to Excel services, which was alreay present in the Office SharePoint Server 2007 version, Visio services makes it possible to render Visio diagrams directly into the browser without  requiring all of your users to have the Visio client installed.

    Enter Silverlight

    Visio services supports two rendering methods. The first one is based on Silverlight and supports all features of Visio services. The second supported rendering method is based on PNG images and is used as a fallback mechanism for users without the Silverlight runtime, but lacks certain features.

    Data Visualizations

    The real strength of Visio services however is to create rich data visualizations of data that is present in various data sources. Visio services has out of the box support for SQL server databases, Excel workbooks (through the use of Excel services) and SharePoint lists. You can extend this list of supported data sources by creating your own custom data connectors. So if you for example store date about the availability of your meeting rooms in a SQL database, you could use Visio services to render a ground plan of your meeting rooms and graphically indicate for each meeting room its availability. Each time the data is updated, the data visualization in the Visio diagram is updated as well.

    Workflows

    Visio services has a strong connections with workflows in SharePoint 2010. First of all, workflows can be designed in Visio 2010 and imported into SharePoint designer. The support for drawing workflow diagrams in Visio 2010 has been greatly improved compared to previous versions of Visio. Second, for workflows designed with Visio, it becomes possible to visualize the current state of a running workflow directly on the workflow diagram by means of Visio services and its support for data visualizations.

    Categories: SharePoint conference 2009 Tags:

    Arrived at the Microsoft SharePoint Conference 2009

    October 20th, 2009 Peter Plessers Comments off

    Karine Bosch and myself are this week attending the Microsoft SharePoint Conference in Las Vegas. We intend to keep you up to date during this week with the latest news and updates on SharePoint 2010 and SharePoint Foundation 2010 (the successor of WSS 3.0).

    When we yesterday left the airplane after a long flight, the first things we saw at the gates where gambling machines. Yes, there could be no mistake, we were definitely in Las Vegas.

    gambling machines at the gate

    Stay tuned for more updates from the city that never sleeps.

    Categories: SharePoint conference 2009 Tags: