1 / 31

Advanced SharePoint Data Access with Microsoft Silverlight

OSP-302. Advanced SharePoint Data Access with Microsoft Silverlight . Paul Stubbs Sr. Architect Evangelist Microsoft Corporation. Scot Hillier SharePoint MVP Scot Hillier Technical Solutions, LLC. Agenda. oData Access to SharePoint Lists SharePoint Client Object Model

amy
Download Presentation

Advanced SharePoint Data Access with Microsoft Silverlight

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. OSP-302 Advanced SharePoint Data Access with Microsoft Silverlight Paul Stubbs Sr. Architect Evangelist Microsoft Corporation Scot Hillier SharePoint MVP Scot Hillier Technical Solutions, LLC

  2. Agenda • oData Access to SharePoint Lists • SharePoint Client Object Model • Embedding Data in HTML • SharePoint Web Services and RSS Feeds

  3. oData Access to SharePoint List Data • Open Data Protocol (oData) is a RESTful protocol • Use standard HTTP methods to access data • Implemented in SharePoint through ListData.svc • Utilize WCF Data Services with Silverlight • Install WCF Data Services on SharePoint server • Set Service reference to ListData.svc • Write type safe code against proxy

  4. Sample oData Uris

  5. Keys to Using this Pattern • Service Reference to ListData.svc • Creates proxy • DataServiceCollection • Observable collection for managing changes to data set returned from WCF Data Services • Create from IEnumerable data set • Bind to grid • DataServiceQuery • An abstract class that represents a single query request to WCF Data Services • AddQueryOption method allows additional parameters

  6. oData and Silverlight Scot Hillier SharePoint MVP Scot Hillier Technical Solutions, LLC demo

  7. Silverlight Client Object Model • Silverlight Development Enabled by Client OM • CRUD operations on lists • Change security permissions • Create sites, pages, custom actions • ClientContext • Site • Web • List • ListItem

  8. Keys to Using this Pattern • Using the .NET Client OM requires adding two references • Microsoft.SharePoint.Client.Silverlight.dll • Microsoft.SharePoint.Client.Silverlight.Runtime.dll • Both are found in [..]\14\TEMPLATES\LAYOUTS\ClientBin • Microsoft.SharePoint.Client.Silverlight.dll • Includes the .NET Client OM API’s • Microsoft.SharePoint.Client.Silverlight.Runtime.dll • Handles all the communication, serialization & deserialization between the client application & SharePoint server

  9. Keys to Using this Pattern • Dynamic Loading of the Client Object Model • Microsoft.SharePoint.Client.xap contains assemblies • Download XAP • Remove assemblies • Load them dynamically assemblyStream = Application.GetResourceStream( new StreamResourceInfo(e.Result, "application/binary"), new Uri(“Microsoft.SharePoint.Client.Silverlight.Runtime.dll", UriKind.Relative)).Stream; assemblyPart = new AssemblyPart(); assemblyPart.Load(assemblyStream);

  10. Client Object Model and Silverlight Paul Stubbs Sr. Architect Evangelist Microsoft Corporation demo

  11. Embedding Data in HTML • Hidden Field used to Contain Data • Allows Silverlight Application to read data from the web page instead of returning to server

  12. Keys to Using this Pattern • Create a custom class • Decorate with [DataContract] • Decorate members with [DataMember] • DataContractJsonSerializer DataContractJsonSerializerjs = new DataContractJsonSerializer(this.GetType()); String result = String.Empty; using (MemoryStreamms = new MemoryStream()) { js.WriteObject(ms, this); Result = Encoding.UTF8.GetString(ms.ToArray(), 0, ConvertToInt16(ms.Length)); }

  13. Keys to Using this Pattern • HtmlInputHidden • Represents a hidden control on the page to contain serialized data set • Pass Hidden Control ID to Silverlight • Silverlight Application reads serialized data set • De-serialize data set

  14. Embedding Data in HTML Scot Hillier SharePoint MVP Scot Hillier Technical Solutions, LLC demo

  15. SharePoint Web Services and RSS Feeds • ASMX web services • Get functionality not supported by other methods • Search • Profiles • RSS Feeds for retrieving data

  16. Keys to Using this Pattern • Setting References to ASMX services • As normal in many cases • GUID or CHAR fields can cause errors • AsmxMessageInspector cleans ASMX messages • AsmxBehavior wraps AsmxMessageInspector BasicHttpBinding b = new BasicHttpBinding(); EndpointAddress e = new EndpointAddress(this.profileEndpointAddress); UserProfileServiceSoapClient c= new UserProfileServiceSoapClient(b,e); c.Endpoint.Behaviors.Add(new AsmxBehavior());

  17. Keys to Using this Pattern • RSS Feeds • WebClient class to call RSS feed • SyndicationFeed class to parse XML WebClientwc = new WebClient(); Wc.OpenReadCompleted += new OpenReadCompletedEventHandler(requestComplete); Wc.OpenReadAsync(new Uri(feedUrl));

  18. Keys to Using this Pattern • Cross-domain calls • Clientaccesspolicy.xml (Silverlight) • Crossdomain.xml (Flash) • Must be in root and have no security • Add to SharePoint using an Http Handler • Required because SharePoint enforces authentication • Requires web.config edits • Intercepts calls going into SharePoint • Response.Write policy file into stream

  19. Web Services and RSS Feeds Scot Hillier SharePoint MVP Scot Hillier Technical Solutions, LLC demo

  20. Summary • oData Access to SharePoint Lists • SharePoint Client Object Model • Embedding Data in HTML • SharePoint Web Services and RSS Feeds

  21. Resources • Session Samples on Code Gallery • http://code.msdn.microsoft.com/spsl • Paul’s Blog • http://blogs.msdn.com/pstubbs • Scot’s Blog • http://www.shillier.com

  22. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification Exam that relate to your session. Also indicate when they can find you staffing in the TLC. Related Content from my team • OSP209| Building Your First Windows Phone 7 Application for Microsoft SharePoint 2010 • OSP301| Integrating Microsoft SharePoint 2010 with Windows Azure • COS375-INT| Integrating Windows Phone 7 and Microsoft SharePoint Using Windows Azure • OSP301| Integrating Microsoft SharePoint 2010 with Windows Azure • OSP319| Taking Office to the Cloud: Integrating Microsoft Office 2010 and Windows Azure • OSP312| Developing Microsoft Office Business Solutions That Span the PC, Windows Phone 7 and Web • OSP304| SAP Interoperability with Duet Enterprise for Microsoft SharePoint and SAP, BCS, and Microsoft Office 2010 • OSP305| Developing Collaboration Solutions in the Cloud with Microsoft SharePoint Online • OSP306| Developing Powerful Workflows in the Cloud with Microsoft SharePoint Online

  23. http://channel9.msdn.com/shows/sharepointsideshow Twitter @SPSideshow

  24. Coming Soon… • Still a work in progress • Get early access and send feedbackon Safari Rough Cuts!http://bit.ly/SPSL_SafariRoughCuts • Download the code on MSDN Code Galleryhttp://code.msdn.com/spsl/

  25. Professional SharePoint 2010 Branding and User Interface Design • CSS • master pages • page layouts • SharePoint themes • XSLT • jQuery • Silverlight • Provides expert tips, techniques, and insights from the author team of SharePoint 2010 branding experts

  26. SharePoint Development Books and DVD

  27. Resources • Connect. Share. Discuss. http://northamerica.msteched.com Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  28. Complete an evaluation on CommNet and enter to win!

  29. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related