News

About Me:
I am a 26 year old female SharePoint Enthusiast. I work for B&R Business Solutions from my home in Olathe, KS. I have been working with SharePoint since I attended the Portal University in 2005. I hold a BA in Computer Science from the University of Missouri - Kansas City. I love playing Rockband, organizing user group meetings, working with MOSS, attending Code Camps as a speaker, and having bizarre conversations about geek things with cool people. If you have any comments or questions fill out the contact form and I will try my best to help.

Rebecca Isserman's Facebook profile

My Stats

  • Posts - 183
  • Comments - 221
  • Trackbacks - 0

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories


Blogs on SharePoint


Other Blogs


Resources on Sharepoint


Stuff



So people are always asking me how do I get Silverlight to work in SharePoint?  Then Paul Galvin and some other people told me why not post the steps.  So here is what you want to do:

  1. Get Visual Studio 2008 and download SP1 from http://www.microsoft.com/downloads/details.aspx?familyid=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en.  The installer may stick at one part and may take an hour or two, so make sure you leave tons of time to spare.
  2. Get the Microsoft Silverlight Tools for Visual Studio 2008 with SP1 from http://www.microsoft.com/downloads/details.aspx?FamilyId=c22d6a7b-546f-4407-8ef6-d60c8ee221ed&displaylang=en.
  3. Get Expression Blend 2.0 from http://www.microsoft.com/downloads/details.aspx?FamilyId=5FF08106-B9F4-43CD-ABAD-4CC9D9C208D7&displaylang=en
  4. Download Expression Blend SP1 from http://www.microsoft.com/downloads/details.aspx?FamilyId=EB9B5C48-BA2B-4C39-A1C3-135C60BBBE66&displaylang=en.
  5. Create a new Silverlight Application using the Silverlight Application Template in Visual Studio 2008 and Expression Blend 2.0

SharePoint specific instructions:

  1. Create a new  Virtual Directory on your SharePoint Application in IIS (c:\inetpub\wwwroot\wss\virtualdirectories\webappfolder\) called ClientBin.  Make sure the directory has Read and Run Permissions.  This directory is where you will put all your compiled Silverlight files (XAP files).
  2. Check the MIME Types in IIS to see if .XAP and .XAML are included (this is added in Server 2008 automagically, but not necessarily in Server 2003).  If these entries are not included add them by using the new button and type in Extension: XAML MIME Type:application/xaml+xml and for the second entry Extension: XAP MIME Type:application/x-silverlight-app.  Adding these extensions as MIME Types makes them trusted extensions.
  3. Add the System.Web.Silverlight.dll to the Global Assembly Cache (click on Start and then Run and type in Assembly and hit Enter, you can drag the assembly into this window). 
    Note: Once you install the Silverlight Extensions for Visutal Studio this should be in the c:\program files directory under the SDK.
  4. Add a Safe Control to your Web .Config File by navigating to the IIS folder for your SharePoint Application (c:\inetpub\wwwroot\wss\virtualdirectories\webappfolder\).  Open the file in NotePad or another editing program and look for the <SafeControls> Tag.  Add this tag at the end of the entries:
    <SafeControl Assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.SilverlightControls" TypeName="*" Safe="True" />
  5. Copy your XAP File into the ClientBin Directory you created above.
  6. Create a SharePoint Webpart and add a reference to System.Web.UI.SilverlightControls and add a using statement.  You should be able to create a new control and reference it in the CreateChildControls like such:
    public Silverlight MySilverlightControl;
    protected override void CreateChildControls()
    {
           MySilverlightControl = new Silverlight();
           MySilverlightControl.ID = "slControl";
           MySilverlightControl.Source = "/ClientBin/MyXAPFile.xap";
           this.Controls.add(MySilverlightControl);
    }

These are pretty much all the steps you need to follow to use a Silverlight Control in a webpart.  You need to also remember that you cannot directly reference the SharePoint Object Model in a Silverlight Control.  You can use the SharePoint Webservices or create your own webservice.  Silverlight renders like a client side javascript application and does not work like an ASP .Net Application.  It is more of a presentation layer than a data layer.  If anyone has any comments, questions, or concerns let me know.


posted @ Thursday, November 20, 2008 2:57 PM | Filed Under [ MOSS ]

Comments

Gravatar # re: Silverlight and SharePoint: Getting Started
Posted by Gary Payne on 11/20/2008 3:49 PM
Hi Becky, good to see some clear instructions for every step!

Another approach that is a simpler way of surfacing a Silverlight app in a web part page is to host the XAP file in a document library and reference that file in an OBJECT tag in a content editor web part. Have a look at my post at http://sharethelearning.blogspot.com/2008/11/silverlight-in-content-editor-web-part.html for details.
Gravatar # re: Silverlight and SharePoint: Getting Started
Posted by MOSSLover on 11/20/2008 3:56 PM
Phil Wicklund posted a 2 part entry on the same thing...Honestly, I'm sure there is about 50 ways to do the same thing. I also noticed someone used a document library to hold the XAP files. There is a SilverPart for SharePoint on CodePlex. I'm hoping the next version of SharePoint is a little more integrated with media files now that Silverlight is gaining more clout.
Gravatar # re: Silverlight and SharePoint: Getting Started
Posted by Greg Farquhar on 12/11/2008 9:58 PM
I am attempting to do just this. I have checked and rechecked all that you say, and it still does not work. I am adding two controls, a simple lable and then my silverlight control. I can see the label but no more.

I have a WIN2008 desktop, running VS2008, with V1.2 of the extensions.

My silverlight control works from a web app OK, but not from WSS. WSS is installed locally as well.

Don't suppose you have any suggestions. I am quite new at WSS, Silverlight is not a problem.

Greg Farquhar
Gravatar # re: Silverlight and SharePoint: Getting Started
Posted by Niklas Saers on 2/20/2009 1:43 AM
Hi Becky, your name turned up everywhere when I searched for Silverlight/Sharepoint developers on Twitter. I'm happy you're keeping a blog and will be following it. :-)

You say "You can use the SharePoint Webservices", do you have any references as to how? Last I checked the SharePoint services were unavailable as Silverlight didn't have all the plumbing to consume them, and the recommended strategy was writing your own services, preferably with JSON, on top of the SP Object model. I'm doing that now for my current project, but I'd VERY much like to toss the added complexity overboard :-)
Gravatar # re: Silverlight and SharePoint: Getting Started
Posted by MOSSLover on 3/1/2009 4:37 AM
I have never done anything with JSON, but I look a good challenge and when I have time (if I ever do again) will try. Consuming the SharePoint Services so far entail Linq to XML and another webservice from what I have seen. What I have since learned is writing your own webservice using the object model and parsing it into an xmldoc, then converting it into a Linq Xdocument works a lot nicer.
Post a comment