Freigeben über


Adventures with Silverlight 3.0 and SharePoint – Part 1

I have been working on getting Silverlight 3.0 to work with SharePoint 2007 and I wanted to share with you the progress I have made and some of the challenges I have remaining.

Project

This project uses Silverlight 3.0, the Silverlight Toolkit for 3.0, and RIA Data Services.  So it is basically using as much as it can that is new.  This means we have a Entity Model and a ASP.NET web application that the Silverlight application will use.  It also uses authentication using the new Domain Service for authentication.

What I did

So the first thing I did was to follow the steps in this blog post about Silverlight 2.  I just changed it to be the System.Web.Silverlight from 3.0.  The suggestion for upgrading the web.config for Silverlight worked great for bringing most of the stuff I needed.

I then did the following steps:

  1. Copied my project under the _layouts folder
  2. Copied the bin folder for my project to the VirtualDirectories\80\bin folder of SharePoint
  3. Ran gacutil on system.web.silverlight
  4. Ran gacutil on system.web.ria
  5. Ran gacutil on system.web.domainservices.webcontrols

I then made some changes to the web.config of my project, namely removing everything that was already in the web.config for SharePoint.  The last change I did was to make the bin folder have FullTrust.  I did this by adding the following to the wss_minimaltrust.config file:

    1: <CodeGroup class="UnionCodeGroup" version="1"
    2:     PermissionSetName="FullTrust">
    3:     <IMembershipCondition
    4:         class="UrlMembershipCondition"
    5:         version="1" Url="$AppDirUrl$/bin/*"
    6:     />
    7: </CodeGroup>

After making these changes, the next problem I ran into was around RIA.  It makes calls using a DataService.axd.  So that needed to be added to the web.config file.  In <system.web>:

    1: <httpHandlers>
    2:     ...
    3:     <add path="DataService.axd" verb="GET,POST" type="System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    4:       validate="false" />
    5: </httpHandlers>

And <system.Webservers>:

    1: <handlers>
    2:     ...
    3:     <add name="DataService" verb="GET,POST" path="DataService.axd"
    4:             type="System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    5: </handlers>

That information is talked about in the Silverlight forum for getting it to work with Azure here.

I then tried to get my application to load the SharePoint master page but I ran into a problem where it tells me:

    1: The referenced file '<path to master>' is not allowed on this page.

I am currently investigating that error and will post more as I progress.  If anyone else is trying to get this to work with SharePoint or has any suggestions, I’d love to hear them.

Comments