Posts Tagged ‘Silverlight’

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

The last week that just passed was filled with quite some cool happenings over at the BPCUK Conference in London. If you’ll follow the #BPCUK tag on Twitter you’ll find all the juicy information that you missed out on – there’s no real need for me to repeat it here :-)

Downloads

As promised, my session deck on Silverlight and SharePoint 2010 can be downloaded here: Download!

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

It probably doesn’t surprise anyone that the BPC conference in London is one of the main events to look forward to in the realm of SharePoint conferences.

I will of course be attending this conference and I’ll be delivering an introductory  session about Silverlight and SharePoint.

My session: Developing with Silverlight + SharePoint 2010 = Awesome

I’ll be talking about how you can utilize Silverlight in SharePoint 2010 to create some cool RIA applications hosted inside (or outside!) of SharePoint.

In this session you’ll get acquainted with what Silverlight is and how it plays along with SharePoint 2010 in various ways.

We’ll of course be looking at how to create our very own Silverlight Web Parts and applications and host them inside of SharePoint 2010.

The preliminary agenda of the session looks something like this;

  • Silverlight 101
  • Integrate with SharePoint 2010
  • Preferred deployment methods and developer guidance
  • Developer patterns
  • OOB Experience (Out of Browser) – Bring your Silverlight app to your desktop
  • And much more

Last years conference (Evolutions conference)

Just like you already know there was a volcano that found it suitable to erupt just in time for the conference last year that put a cane in the wheels for a lot of the attendees and speakers.

My flights were cancelled in last minute so I had to find another way of making my way to the conference last year. One day before the conference I basically gave up hope and I just posted a tweet on Twitter saying "Hey, I need to go from Sweden to England, any takers?".

A few minutes later a good friend of mine calls me up saying "Hey, I’m going to The Netherlands to pick up my girl since the flights are cancelled and boats and trains are full. I’m leaving in a few hours by car toward NL. Care to join?"

Alright, why not I thought… We drove from Sweden through Denmark, Germany and finally reached Rotterdam in Holland after a long journey. This is where he picked up his girl and were bound to head back to Sweden again.

I’m dropped off there, in the middle of nowhere, without any means of getting back to Sweden or getting on to England. All the boats and trains were full, remember? 
This is where I’m using Twitter again and post a tweet asking if anyone is in Rotterdam and will be driving to England in the near future.

Marianne tweets me back saying "Hey, we’ve got a spare seat in the car, we’ll pick you up tomorrow at 08.00 outside your chosen hotel". Sweet! Now we’re talking.

We drove from Holland through Belgium and France to finally take the Eurotunnel and reach England.

Even though that trip was a real blast and can’t really be depicted in words here, I really hope that the flights are leaving as scheduled this time!

Steve explaining the long journey

Summary

So if you’re attending BPC UK this year and care to join us in our adventures in the SharePoint jungle and the pubs – ping me.

This year I’m counting on the flights and I’m hoping to see as many of you as possible for the conference in London next week.

Until then, be awesome.

How To: SharePoint and Silverlight 2.0 – Part 1

December 10th, 2008 by Tobias Zimmergren

Author: [MVP] Tobias Zimmergren
Web: http://www.zimmergren.net

Prephase

I have previously written up a few articles on how you can get more from your SharePoint environment by enhancing it with AJAX, .NET 3.5 and Silverlight.

References to those articles can be found here:

My intention is to get a SharePoint / Silverlight article series going, and this is to be the first article in the series – How to get up and running!

Prerequisits

Must have:

Note: I’m not going to describe how you create a .xap file – you’ll find plenty of resources for that on the net. Just go google! (Live.com, yeah!)

Nice to have:

Part 1 – Step by step to configure your SharePoint environment for Silverlight 2.0

First of all, if you don’t want to do the manual .NET 3.5 settings in your web.config – there’s a great feature to take care of this on CodePlex which can be found under the Features project.

Step 1: Download, install and deploy the .NET 3.5 Web Config feature
  • Download the .NET 3.5 web.config feature from here
  • Install the .wsp into your SharePoint environment
  • Deploy the .wsp into your SharePoint environment to the appropriate Web Application
    image
  • Activate the feature for your Web Application (the one you deployed to)
    (This is done from Central Administration – Application Management – Manage Web Application Features)
    image 

Now we’re all set with the pre-configurations of the web.config – though there’s one more thing we need to manually do.

Step 2: Adding the final touches to web.config manually

Since the features project doesn’t include Silverlight by default (except for the Beta 2 version, which we’re not interested in..) you should now open up your web.config manually and

  • add the following line to <system.web> <compilation> <assemblies>:

<add assembly="System.Web.Silverlight,
    Version=2.0.5.0,
    Culture=neutral,
    PublicKeyToken=31bf3856ad364e35" />

It should look something like this:
image

Step 3: Add System.Web.Silverlight.dll to the GAC (Global Assembly Cache)

Add the System.Web.Silverlight.dll to the Global Assembly Cache (either drag’n’drop it into C:Windowsassembly or use Gacutil.exe or use the default .NET Configuration Tool)

You’ll find the System.Web.Silverlight.dll assembly in the Silverlight 2.0 SDK folder, located here:

C:Program FilesMicrosoft SDKsSilverlightv2.0LibrariesServer

Step 4: Set the correct MIME-type for the Silverlight .xap filetype

Go to your IIS management console (Start – Run – “inetmgr” without the quotes)

  • Select your Web Application from the list, and select properties:
    image
  • Choose “HTTP Headers” and then “MIME Types…”
    image
  • Add the MIME-type for Silverlight 2.0 Applications as shown:
    image
  • Okay, Okay, Okay (Press the buttons..)
  • Close the IIS manager as we will not need it anymore for the time being!

Now when all those fancy-pancy things are done – let’s get rolling with creating a simple Hello World Web Part using Silverlight 2.0, shall we?

Part 2 – Creating a first Web Part to host a Silverlight application

If you’ve read this far you should now be set up properly to create a Silverlight Web Part (Really, a Web part that loads the silverlight application and renders in the browser)

Step 1: Visual Studio 2008 time!

First of all, make sure you’ve got the .xap file in handy, then launch Visual Studio 2008 SP1.

  • Create a new Web Part project in your desired fashion – I’m using the WSS Extensions for ease:
    image
  • Add a reference to the System.Web.Silverlight assembly and to the System.Web.Extensions assembly, it should look something like this:
    image
     
  • Add the following using statements:
    Note: I’ve stripped down the default using statements, as they’re overkill for this – this is what you should need

    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.SilverlightControls;

  • Make an override on the OnInit method (We will dynamically add a ScriptManager to the current page, if there’s not one already):

    protected override void OnInit(System.EventArgs e)
    {
        base.OnInit(e);
        var sm = ScriptManager.GetCurrent(Page);
        if(sm == null)
        {
            var scriptManager = new ScriptManager();
            scriptManager.EnablePartialRendering = true;
            Page.Form.Controls.AddAt(0,scriptManager);
        }
    }

  • Write the following very simple code to load a Silverlight class into the Web Part, set it’s source to our .xap file and simply add it to the controls collection:  

    private Silverlight mySLControl;
    protected override void CreateChildControls()
    {
        base.CreateChildControls();
        mySLControl = new Silverlight
        {
            ID = "HelloSilverlightControl",
            Width = new Unit(367), 
            Height = new Unit(150),
            Source = @"/_layouts/ZimmerLight/Hello/Hello.xap"
        };
        Controls.Add(mySLControl);
    }

  • Build and deploy the Web Part, and cross your fingers!
    (Using the WSS Extensions for Visual Studio, just rightclick the project and choose Deploy)
    image 
Step 2: Add the Web Part to a page
  • I’ve put my Web Part in a “Silverlight Web Parts” group – simply choose it and click add.
    image 
  • Voila, a fully functional Silverlight 2.0 Web Part rendered inside SharePoint – without any trouble!
    image


Summary and Download

As you’ve seen in this article, it isn’t too hard to get up and running with Silverlight 2.0 (and .NET 3.5 of course) and get our first Silverlight 2.0 Web Part spinning in SharePoint.

You should now be able to:

  • Configure your environment to use Silverlight 2.0
  • Hook up your Silverlight Application(s) in SharePoint
  • Enjoy the richness of Silverlight in SharePoint!

You can download the Visual Studio project from here

Comments and Feedback appreciated

Please leave your print in the comments, feedback is always nice :-)

Over at Dan Wahlins blog you can listen to a new Silverlight song.

Go check it out and relax to some sweet Silverlight music.

- I know, I’m a geek.

Author: Tobias Zimmergren

I got a chance to finally try the blueprints out, and it works fine. It’s a couple of steps on the way that needs to be performes, listed below.

What you need to think about when setting it up is to make sure the following pre-requisities are installed on your SharePoint server:

  • .NET Framework 3.5 installed
  • Service Pack 1 for SharePoint (WSS 3.0 / MOSS 2007 depending on which version you run)
  • Silverlight 2.0 beta 1 runtime browser plugin
  • Configure the *.xap file type extension as a MIME type in your IIS webserver as: application/x-silverlight-2-b1
  • Configure the web.config using the ASP.NET 3.5 AJAX tags and the Silverlight configurations

Since I make an assumption that you guys already know how to complete the first few tasks here, I’ll just give you the web.config changes that needs to be made and then you can simply run the Setup for the Blueprints and have a whole lot of Silverlight/SharePoint fun.

Changes that needs to be done in your SharePoint application’s web.config in order to run Silverlight applications

This section will give you a walkthrough to what you need to do in your web.config in order to get the Silverlight Blueprints up and running.

Under the <configSections>-element, add the following code:

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
      <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    </sectionGroup>
  </sectionGroup>
</sectionGroup>

Under the <assemblies>-element, add the following code:

<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Under the <pages>-element, add the following code:

<controls>
  <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>

Under the <httpHandlers>-element, add the following code:

<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

Under the <httpModules>-element, add the following code:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Under the <runtime>-element, add the following code inside the <assemblyBinding>-tag:

<dependentAssembly>
  <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
  <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
  <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
  <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>

Under the <configuration>-element, add the following code at the end (in the bottom of web.config)

<system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
      <modules>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </modules>
      <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </handlers>
    </system.webServer>

Time to install and deploy the Silverlight Blueprints and try the Silverlight Web Part out!

If you’ve come this far and ensured that your SharePoint site still runs with the newly added lines of code, and you have ensured that all the aforementioned pre-requisites are fulfilled – You’re ready to go!

  1. Run setup.exe for the Blueprints Hello Silverlight 2 Web Part and make sure that the System Check passes all tasks
    Silverlight Blueprints Setup
  2. Define which web applications that you would like to deploy this webpart to (tip: the one you’ve edited web.config for would be a good choise ;-)  ) – In my case it’s http://zimmergren:8003 
    Define where the solution should be deployed
  3. Just hit next and let the installation and deployment complete – Sit back and relax for those sweet 8 seconds.
  4. Navigate to the site application where you installed the Blueprints (In my case http://zimmergren:8003 which is a normal Collaboration Portal), from there, click the following:
    1. Site Actions
    2. Site Settings
    3. Modify all site settings
    4. Site Collection Features
    5. Activate on the feature called "Silverlight BluePrint for SharePoint: Hello Silverlight 2 Web Part" 

      Activate the Silverlight BluePrint for SharePoint web part

  5. If you havn’t already, create a new Blank Site (for ease and simplicity) and call it anything (I called mine Blueprints)
  6. Do the following:
    1. Site Actions
    2. Edit Page
    3. Click "Add a Web Part"
    4. Locate the section called "Silverlight BluePrint for SharePoint"
    5. Choose the Web Part called "Silverlight BluePrint for SharePoint: Hello Silverlight 2 Web Part"
      Add the Silverlight WebPart to your SharePoint page
  7. You’re all set. Cross your fingers and hope that it all works :-)

Proof that it actually works

On this screenshot you can see that the Web Part works, and when I right click you see the Silverlight menu as in any other Silverlight application.

Hello Silverlight 2 Web Part Proof Of Concept

And here’s another image with the Picture Viewer Silverlight WebPart:

Silverlight BluePrint for SharePoint Media Viewer Web Part Proof of Concept

Known Issues

  • If the version of your Silverlight 2.0 beta1 runtime differs from the one the Blueprints were compiled with, you’ll end up with an empty white webpart – although you can rightclick and get the Silverlight menu to show. In order to fix this problem, simply open the source project in Visual Studio and recompile it – then copy the .xap file to your setup’s ClientBin folder and replace the one there. (Or simply copy it to your filesystem directly to e.g. C:InetpubwwwrootwssVirtualDirectories8003ClientBinSL.HelloSilverlight2SL.XAML.HelloSilverlight2.xap
    • This problem was solved after conversating with Patrick, so – I now owe you a beer when I see you Patrick!

Last words

I sincerely hope that this helps you out in the process of configuring and getting your Silverlight Blueprints for SharePoint up and running quickly and with ease!

Thanks for tuning in, please leave a comment or drop a line in the mail – appreciate it! :)

Posted by; Tobias Zimmergren on http://www.zimmergren.net

Technorati Tags: , ,

Author: Tobias Zimmergren
Url:
http://www.zimmergren.net

Yep. It’s me again…

I managed to salvage most of the data from the bluescreen a couple of hours earlier (due to the persistent use of source control).

I’ll cover this topic more in details in one of the days to come, for now – this is what it looks like:

 slclock

Please do comment!

Have a good night everybody! I sure will, now.

Silverlight (2.0) Blueprints for SharePoint

March 3rd, 2008 by Tobias Zimmergren

Author: Tobias Zimmergren
Url:
http://www.zimmergren.net

Hi people, been really busy the last couple of weeks and havn’t had the time to answer your mails nor write any new blogposts.

However, I just felt that I needed to get this link out there for you guys to check out in case you havn’t already: http://www.ssblueprints.net/sharepoint/

"Open Source Source Code and Full Blueprint coming soon" – Sounds promising

While you check out that link, I’ll try to figure out the topic of my next MOSS post ;)

Silverlight and SharePoint integration

November 9th, 2007 by Tobias Zimmergren

I’m writing this post as a question/survey and want to know if there’s any interest in actually posting a blog on some different integration-possibilities with SharePoint and Silverligt.

I’ve created a couple of smaller projects that uses SharePoint’s exposed webservices to create a nice Silverlight application to present the information (in this case some info from the news-list) which then can be displayed nicely on a projector or in a store or why not on the LCD-TV’s that a lot of companies have these days to display information to the people that visit the place. Or why not as a billboard – use your imagination.

With this post I’m just curious as to weather there’s any interest in seeing such posts coming up, and if so – please leave me a comment in this post or email me using the contactlink.

Thanks for tuning in,
Time to fall asleep on the train here again.

Silverlight with Ian Blackburn

November 6th, 2007 by Tobias Zimmergren

I’m on the train right now with two of my colleagues, heading to Stockholm to attend a Silverlight course held by Mr. Ian Blackburn himself.

I’ll be sure to post some interesting stuff about Silverlight and SharePoint integration soon, as I’ve made a couple of integrations the past couple of days.

Cheers