1 / 19

Silverlight in SharePoint WebParts

Silverlight in SharePoint WebParts. You got peanut butter in my chocolate. Who Am I?. Shawn Wildermuth shawn@agilitrain.com C# MVP, MCSD, MCT, INETA Speaker, Author AgiliTrain Silverlight for SharePoint – Atlanta, June 2-4, 2009 Silverlight Tour – Atlanta, July 20-22, 2009

cliff
Download Presentation

Silverlight in SharePoint WebParts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Silverlight in SharePoint WebParts You got peanut butter in my chocolate

  2. Who Am I? • Shawn Wildermuth • shawn@agilitrain.com • C# MVP, MCSD, MCT, INETA Speaker, Author • AgiliTrain • Silverlight for SharePoint – Atlanta, June 2-4, 2009 • Silverlight Tour – Atlanta, July 20-22, 2009 • Advanced Silverlight – Atlanta, August 3-4, 2009

  3. Agenda • Why Silverlight? • SharePoint Integration • Linking Projects • Hosting in SharePoint • Using Web Services • Debugging

  4. What’s SharePoint? • I am not a SharePoint Expert… • …Some of the Techniques Here May Be Hacky… • Goal is to show how it *can* work • So you can apply it to your exceptional SharePoint Skills

  5. SharePoint

  6. Why Silverlight in SharePoint • Leave to SharePoint (and Web) What They Do Well • Silverlight for Islands of Content • Where Graphics and Interactivity Helps • Don’t Overuse it

  7. Using Silverlight in WebPartProject • Can Create Silverlight in Same Solution • No Official Linking • Must Do Manually • Post-Build, Shared File, MSBuild • Add XAP to WebPart XML file for Deployment

  8. Using Silverlight in WebPartProject • WebPart.xml • May be better as separate module <?xml version="1.0" encoding="utf-8"?> <Elements Id="..." xmlns="..." > <Module Name="WebParts" List="113" Url="_catalogs/wp"> <File Path="SilverlightTaskViewer.webpart" Url="SilverlightTaskViewer.webpart" Type="GhostableInLibrary" /> <File Path="SilverlightTasksWidget.xap" Url="SilverlightTasksWidget.xap" Type="GhostableInLibrary" /> </Module> </Elements>

  9. Demo New Silverlight Web Part

  10. Hosting in SharePoint • WebPart Can Create HTML Code • LiteralControl and ObjectTag public class SilverlightTaskViewer : WebPart{ protected override void CreateChildControls() { base.CreateChildControls(); string hostTag = @"<object ...></object>"; // Put the Object Tag the control collection LiteralControlslObj = new LiteralControl(hostTag); Controls.Add(slObj); } }

  11. Hosting in SharePoint (2) • Browser Cache a Problem • SPUtility.MakeBrowserCacheSafeLayoutsUrl() • Can help but must be in a template to work

  12. Hosting in SharePoint (3) • WebPart Can Create HTML Code • Can Use Silverlight control and ScriptManager • But why?

  13. Demo Showing Silverlight in WebPart

  14. Using SharePoint Web Services • Creating ServiceReferences to SP “Just Works” • http://<Machine>/_vti_bin/Lists.asmx • http://<Machine>/_vti_bin/Alerts.asmx • Etc.

  15. Using SharePoint Web Services (2) • Data Returned is Typically XML • Must Use Projection to Shape for DataBinding XElement tasks = e.Results; varqry = from i in e.Result.Descendants(rowName) select new Task() { Title = i.Attribute("ows_Title").Value, Priority = i.Attribute("ows_Priority").Value, Status = i.Attribute("ows_Status").Value, }; theList.ItemsSource = qry.ToList();

  16. Demo Consume a Web Service

  17. Debug Considerations • Pain Points with Debugging the Silverlight Code • Browser Cache Need Invalidated to Debug • “Run with Debugging” Only Works Locally • Remote Debugging Silverlight is not trivial • Attach To Process Works Well • Cross Domain May Be An Issue Too.

  18. Demo Debugging Silverlight in WebPart

  19. Questions? • Links: • My Blog (Code is Available Here) • http://wildermuth.com • My Email: • shawn@agilitrain.com • Silverlight.NET • http://silverlight.net Shawn Wildermuth AgiliTrain Microsoft MVP (C#), MCSD

More Related