Karine Bosch’s Blog

On SharePoint

Professional SharePoint 2007 Reporting with SQL Server 2008 Reporting Services

When I came home from work tonight, I found a package that I was waiting for a looong time: the recently published book on SharePoint 2007 and SQL Server 2008 Reporting Services. Some months ago I worked on a project where we needed to generate reports based on SharePoint 2007 data using Reporting Services. It was not that easy to put all parts together and to generate descent and useful reports.

It’s finally on the book shelf in your book store. It is published by Wrox but a big thank you goes to the authors Reza Alirezaei, Coskun Cavusoglu and Jacob J. Sanford. Go and get it to have this little jewel on your bookshelf or under your christmas tree.

November 3, 2009 Posted by Karine Bosch | SharePoint 2007 | | No Comments Yet

SharePoint 2010 Development

November 1, 2009 Posted by Karine Bosch | SharePoint 2010 | | No Comments Yet

SharePoint Conference 2009 @ Las Vegas

Together with my colleague Peter Plessers I’m at the SharePoint Conference 2009 in Las Vegas. They couldn’t have chosen a better location: a glamorous location for a glamorous product. I’m excited to follow a lot of sessions on SharePoint 2010. Pitty I cannot follow all of them.

Thank you product team for all the great work you did! Thank you for listening to our complaints and actually do something with it.

This week is for me like a fairytale that comes true, meeting all these great SharePoint MVPs and members of the product team. My feelings are tossed between very proud to very humble. Thank you all for your kindness and your warm welcome. Thank you Patrick for everything you’ve done for me. I will never forget that I achieved this thanks to you. So sad we are not here together.

I will be blogging on the sessions I follow from this blog. Have a nice reading time!

October 21, 2009 Posted by Karine Bosch | SharePoint 2010, SharePoint Conference 2009 | | No Comments Yet

Visual Studio 2010 and Silverlight 3

After having installed Visual Studio 2010 I wanted to start developing a Silverlight 3 application. The Silverlight project templates seem available but when trying to create a Silverlight application, I got an error message mentioning that the Silverlight developer runtime wasn’t installed.
To be able to create a Silverlight 3 project I had to download and install the following things:

Visual Studio 2010 comes with some enhancements when it comes to Silverlight 3 application development. You can develop Silverlight applications for different versions of the runtime, meaning that you can choose if you want to develop for Silverlight 2 or Silverlight 3. You can also drag and drop controls from the toolbox onto the Silverlight interface, like for any other type of application.  But there are also some limitations: .NET RIA Services development is not yet available for Visual Studio 2010. You can read more about this in Tim Heuers post.

September 27, 2009 Posted by Karine Bosch | Silverlight | | No Comments Yet

SharePoint Conference 2009 in Las Vegas

Last week I subscribed for the SharePoint Conference 2009 in Las Vegas from October 19th till 22th. I hoped that the conference would be full of SharePoint 2010 stuff and it is! Here is a sneak peek of some conference titles:

  • SharePoint 2010 Overview and What’s New
  • Upgrading to SharePoint 2010
  • SharePoint 2010 Capacity and Performance Planning
  • SharePoint 2010 Security and Identity Management: What’s New
  • Visual Studio 2010 Tools for Office Development
  • SharePoint 2010 Ribbon, ECMAScript and Dialog Framework Development
  • Developing with REST and LINQ in SharePoint 2010
  • Upgrading SharePoint Server 2007 Code to SharePoint 2010
  • Building Composite Applications with the Microsoft Application Platform
  • What’s New in Business Connectivity Services (The Business Data Catalog Evolves!)
  • FAST Search for SharePoint – Capabilities Deep Dive
  • Advanced Dashboard Creation with Performance Point Services for SharePoint 2010
  • Overview of Visio and Visio Services for SharePoint 2010
  • SharePoint 2010 Web Content Management Deep-Dive
  • If You Build It, They Will Come – Driving End User Adoption

I also subscribed for the post-conference day on October 23th ”SharePoint 2010 Developer Deep Dive” by Ted Pattison and Andrew Connell. 

Almost can’t wait!

Hope to see you there!

August 14, 2009 Posted by Karine Bosch | Uncategorized | | 2 Comments

Create a SharePoint Application Page hosting a Silverlight 3 application

In my previous post on Silverlight 3 integration in SharePoint I explained that there is no System.Web.Silverlight.dll in the SDK anymore. Of course you can install the Silverlight 3 SDK side by side with the Silverlight 2 SDK to be able to continue using the <asp:Silverlight> control but  if you want to keep up with the newest technologies, you adapt to the rules.

In that case you can use the <object> tag to create the Silverlight application. The code snippet below contains the entire application page.

<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            }
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
            if (errorType == "ImageError" || errorType == "MediaError") {
                return;
            }
            var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";
            errMsg += "Code: " + iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";
            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " + args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }
            throw new Error(errMsg);
        }
    </script>
    <div id="silverlightControlHost" style="width:300;height:100">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
            width="100%" height="100%">
            <param name="source" value="HelloSilverlight3.xap" />
            <param name="width" value="300" />
            <param name="height" value="100" />
            <param name="onError" value="onSilverlightError" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="3.0.40624.0" />
            <param name="autoUpgrade" value="true" />
            <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration: none">
                <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                    style="border-style: none" />
            </a>
        </object>
    </div>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Silverlight 3 Demo Application Page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" runat="server" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea">
    Silverlight 3 Demo Application Page
</asp:Content>

InitParameters can be passed by using another <param> element. The value string is comma separated as it has always been:

<param name="initParameters" value="key1=value,key2=value2" />

The only disadvantage is that you have to click the Silverlight application before you can start interacting with it.

Silverlight 3 app page

You can download the demo project here. Have fun with it!

July 24, 2009 Posted by Karine Bosch | SharePoint 2007, Silverlight | | 13 Comments

10 New SharePoint Themes

Microsoft released 10 new SharePoint teams already some time ago but I only tried them out recently. They are realy fantastic!

This is a sample of the Team Site theme:

 TeamSiteTheme

And this is an example of the Owner/Approver/Reviewer/Participant theme:

 ApproverTheme

You can download the WSP here.

You can download the Visual Studio 2008 extensions here.

July 24, 2009 Posted by Karine Bosch | SharePoint 2007 | | 2 Comments

SharePoint 2010 Sneak Peek

Microsoft has released some sneak peek videos about SharePoint 2010 and Office 2010. I’m really excited because it looks very promising. There are 3 videos for SharePoint 2010:

General Overview: overview of the new features and the ameliorations to the user interface, including the ribbon for an intuitive and contextual menu, a completely redesigned SharePoint Designer, Business Connectivity Services (which takes the Business Data Catalog one step further).

For the IT-Pro: SharePoint 2010 provides a rich set of new tools and features like a streamlined Central Administration, a Best Practices Analyzer, better usage reporting and logging.

For the Developer: This is my favorite one :) Visual Studio 2010 will offer a new set of SharePoint templates and tools for creating, packaging and debugging SharePoint solutions. Visual Studio includes also a new designer for building Business Connectivity Services Entities, which looks very promising. There is LINQ for SharePoint and a long awaited client object model.

PS. The site is made using Silverlight! Very beautiful.

There are also some Office 2010 videos available.

July 19, 2009 Posted by Karine Bosch | SharePoint 2007 | | No Comments Yet

Integrating Silverlight 3 in SharePoint 2007

Silverlight 3 has been released last week and it comes with really really great features. To learn more about them, I refer to posts like those of Tim HeuerScott Guthrie and Shawn Wildermuth. And a blog I personally like very much is the blog of Mike Snow.  Besides those listed here, there are a lot of other interesting resources you can find on the net.

All these new features sounds very exciting. Today I have been trying to integrate Silverlight 3 into SharePoint and it has not been easy at all.

Installation of Silverlight 3

 - Download Silverlight 3 runtime and install

- Download the Silverlight 3 SDK and install 

- If you are a developer, download Silverlight 3 Tools for Visual Studio and install. If you run  your environment in a Virtual PC (like most of the SharePoint developers do) you will encounter problems when you have no internet connection from within your Virtual PC. Until the beta version of Silverlight 3 you could use the trick to copy the content of the temporary folder while the exe was aching to install, and then install everything separately, but this time you will not find the Silverlight.3.x_Developer.exe file to enable Silverlight debugging in Visual Studio so you DO need an internet connection this time. (To enable internet access from within your VPC, I can recommend this post).

- If you need to develop more advanced user interfaces (and you will), you can download and install the Blend 3 trial.

If you installed all these bits, you are ready to go. Open Visual Studio 2008 and you can start developing your first Silverlight 3 applications. Exciting isn’t it? But if you are a SharePoint developer like me, there is the next hurdle to take: how can I display my first Silverlight 3 application in SharePoint? The SharePoint path has always been steep and has never been easy to take.

Configuration of the SharePoint server

Here comes the good news: in despite of previous versions, with Silverlight 3 you have to change NOTHING to the web.config of your SharePoint web application(s) on the server. You only have to configure the web.config for Framework 3.5 but this can easily lazily be done by Visual Studio 2008.

The last week I received a lot of questions on my blog: “Where is the System.Web.Silverlight.dll? I can’t find it.”. Well, I’m sorry, but it doesn’t exist anymore. You have to create the silverlight applications from within javascript, at least if you want to stay compatible.

Consequences for the SharePoint developer

You have two options:

- You are conservative and you install the Silverlight 3 SDK side by side with the Silverlight 2 SDK. In that case you can continue using the SilverlightControl, even with Silverlight 3 applications. 

- You are progressive and you remove the Silverlight 2 SDK and install the Silverlight 3 SDK. In that case you have to change your code.

The conservative way

Install the Silverlight 3 SDK side by side with the Silverlight  2 SDK. In that case the System.Web.Silverlight.dll is still available and can be deployed in the Global Assembly Cache, and you can continue using the Silverlight control, residing in that System.Web.Silverlight.dll. The control works with Silverlight 2 and Silverlight 3 applications.

PS. I haven’t checked HttpWebRequest to call SharePoint web services, so I don’t know if that’s boobytrapped too. 

The progressive way

Update 25/07/2009: because of encountering problems with execution of the script inside the web part code, I altered this post slightly.

This post explains how you can create a SharePoint web part that hosts a Silverlight 3 application. In a following post you will read how to host a Silverlight 3 application from within an application page. Both techniques are the basics that can be used in every SharePoint development scenario.

Create a javascript file with f.e. the name SpSilverlight.js. Include the following script to create a Silverlight application based on the silverlight.CreateObjectEx method:

function onSilverlightError(sender, args) {
         var appSource = "";
         if (sender != null && sender != 0) {
            appSource = sender.getHost().Source;
         }
           
         var errorType = args.ErrorType;
         var iErrorCode = args.ErrorCode;
         if (errorType == "ImageError" || errorType == "MediaError") {
             return;
         }
         var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;
         errMsg += "Code: "+ iErrorCode + "    \n";
         errMsg += "Category: " + errorType + "       \n";
         errMsg += "Message: " + args.ErrorMessage + "     \n";
         if (errorType == "ParserError") {
             errMsg += "File: " + args.xamlFile + "     \n";
             errMsg += "Line: " + args.lineNumber + "     \n";
             errMsg += "Position: " + args.charPosition + "     \n";
         }
         else if (errorType == "RuntimeError") {          
             if (args.lineNumber != 0) {
                 errMsg += "Line: " + args.lineNumber + "     \n";
                 errMsg += "Position: " +  args.charPosition + "     \n";
             }
             errMsg += "MethodName: " + args.methodName + "     \n";
         }
         throw new Error(errMsg);
}
function createSL(divid, swidth, sheight, source, initparameters)
{
    var pluginid = divid + "Plugin";
    var divElement = document.getElementById(divid);
    var altHTML = divElement.innerHTML;
    if (swidth == null)
       swidth='100%';
    if (sheight == null)
       sheight='750px';     
    Silverlight.createObjectEx(
    {
        source: source,
        parentElement: divElement,
        id: pluginid,
        properties:
        {
          // Plug-in properties
          width:swidth, 
          height:sheight,
          minRuntimeVersion:'2.0.31005.0'
        },
        events:
        {
           OnError: onSilverlightError // OnError property value -- event-handler function name.
           // OnLoad property value -- event-handler function name.
        },
        initParams: initparameters
    });
}

You can also create a Silverlight object using the silverlight.CreateObject method and include that in the SpSilverlight.js file.

In your web parts in the OnPreRender event you will have to register following javascript files:

  •  the Silverlight.js file (which comes with Silverlight and can be found in the C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Tools directory)
  • the SpSilverlight.js file you just created.
protected override void OnPreRender(EventArgs e)
{
     base.OnPreRender(e);
     ClientScriptManager cs = Page.ClientScript;// Include the required javascript file.
     if (!cs.IsClientScriptIncludeRegistered("sl_javascript"))
         cs.RegisterClientScriptInclude(this.GetType(), "sl_javascript", "/_LAYOUTS/SL3/Silverlight.js");
     if (!cs.IsClientScriptIncludeRegistered("spsl_javascript"))
         cs.RegisterClientScriptInclude(this.GetType(), "spsl_javascript", "/_LAYOUTS/SL3/SpSilverlight.js");
}

Notice the path to the javascript files. I both deployed them to a sub folder of the 12\TEMPLATE\LAYOUTS folder. To avoid having to deploy these files for each web part and application page, you can best deploy them once to a single sub folder of the 12\TEMPLATE\LAYOUTS folder. You can also deploy them to the ClientBin folder under your SharePoint web application (in IIS).

Call the above javascript from within the CreateChildControls method:

protected override void CreateChildControls()
{
    string slstring = "<script type=\"text/javascript\">"
       + "createSL('silverlightHost', '300', '100', '/_LAYOUTS/SL3/HelloSilverlight3.xap', null);"
       + "</script>";
    silverlightHost = new LiteralControl(string.Format("<div id=\"silverlightHost\" style=\"width:100%; height:100%\"></div>{0}", slstring));           
    this.Controls.Add(silverlightHost);
}

If you need to pass data to the Silverlight control you need to set the initParams argument. This is a comma delimited string which has the following syntax:

key1=value1,key2=value2,...

Note that there are no spaces.

The CreateChildControls method would look as follows:

protected override void CreateChildControls()
{
    string xaplocation = "/_LAYOUTS/SL3/HelloSilverlight3.xap";
    string initparams = string.Format("url={0},list=Shared Documents", SPContext.Current.Web.Url);
    string slstring = string.Format("<script type=\"text/javascript\">"
       + "createSL('silverlightHost', '300', '100', '{0}', '{1}');"
       + "</script>", xaplocation, initparams);
    silverlightHost = new LiteralControl(string.Format("<div id=\"silverlightHost\" style=\"width:100%; height:100%\"></div>{0}", slstring));           
    this.Controls.Add(silverlightHost);
}

Voila! If you get this easy one to work, you are ready to go for all the great new stuff Silverlight 3 brings you!

Have fun!

July 17, 2009 Posted by Karine Bosch | SharePoint 2007, Silverlight | | 42 Comments

I will be present(ing) at the Community Day 2009

The 3th edition of the Belgian Microsoft Community Day will take place on Tursday 25th June at th Utopolis in Mechelen. All user groups are joining forces to organise a free event with lots of interesting presentations. Thanks to Ilse Van Criekinge, Jill Cleerens and all others who helped behind the scenes to organise this big event!

I’ll give a presentation on behalf of the BIWUG (SharePoint user group) on how Silverlight can play a useful role in SharePoint. As I’m also writing a MSDN white paper on this subject, I’m all over into it. It’s more or less the same presentation as I gave some weeks ago for the Silverlight user group, but this time the explanation will be more SharePoint oriented. I will try to show some great demos like a list based on a custom list template that opens a Silverilght-enabled form when the New or Edit button is clicked, and an application page that retrieves and updates SharePoint data. All aspects on communication between SharePoint and Silverlight and between Silverlight and SharePoint will be explained.

If you still haven’t registered for this event or if you are curious about what’s offered, please hurry to this site. Hope to see you in Mechelen!

June 23, 2009 Posted by Karine Bosch | Uncategorized | | 1 Comment