1269 SharePoint 2010 Development with Silverlight

Gratis

0
0
610
4 months ago
Preview
Full text

www.it-ebooks.info

  NET Development Series was established in 2002 to provide professional developers with the Authors in this series include Microsoft architects, MVPs, and other experts and leaders in the field of Microsoft development technologies. Each book provides developers with the vital information and critical insight they need to write highly effective applications.

T most comprehensive, practical coverage of the latest .NET technologies

  Authors in this series include Microsoft architects, MVPs, and other experts and leaders in the field of Microsoft development technologies. Each book provides developers with the vital information and critical insight they need to write highly effective applications.

Bob German Paul Stubbs

  The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrievalsystem, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or like- wise.

Contents at a Glance

PART I Getting Started 1 Getting Started with SharePoint and Silverlight 2 Introduction to SharePoint Development 3 Introduction to Silverlight Development

PART II SharePoint and Silverlight Development

4 A First Look at Silverlight in SharePoint 5 Web Part Development 6 Expression Blend, Data Binding, and Sample Data 7 Accessing SharePoint Using the HTML Bridge 8 Accessing SharePoint Data with the Client Object Model 9 Accessing SharePoint Data with WCF Data Services 10 Accessing SharePoint with Web Services 11 Accessing External Data PART III Building Solutions 12 Windows Phone 7 SharePoint Applications 13 Creating Silverlight Navigation 14 SharePoint and Silverlight in the Cloud 15 Creating a Silverlight Field Control vii This page intentionally left blank

Contents

  With the release of SharePoint 2010, Microsoft made it easier to consume and integrate data stored within SharePoint into Silverlightapplications with the client object model and a new RESTful service. Part 2 dives into the fundamentals and basics you need to know, such as working with the client object model, the REST serv-ice, web services, and external data (that which SharePoint is aware of but lives in another system).

Acknowledgments

  We’despecially like to thank Joan Murray for the opportunity to write the book, for her constant feedback and encouragement, and for deftly guiding usthroughout the publishing process.xxi Bob German I want to thank my parents, who wrote more than 35 books, for inspiring me to write and exposing me to the writing process at a young age. Bob is going to have a brightfuture in writing more books, and I look forward to doing more projects with Bob in the future.

About the Authors

  The most common extension by far is to add custom “web parts,” which are small applicationcomponents that appear on the screen as part of a SharePoint solution.(Web parts are similar to “portlets” or “widgets” used by other portal plat- forms.) However this is really only the beginning, as developers can alsoextend SharePoint workflows, add custom application and administrative pages, connect to line-of-business data, and more. It wasn’t long after the introduction of NCSA Mosaic, the first graphical web browser, that it was dubbed a “killer application.” Instead of a hodge-podge of tools such as WAIS, FTP, and Gopher, the web browser provided universal access to Internet resources in a way that was easy enough for anycomputer user.

SILVERLIGHT VERSIONS IN THIS BOOK Silverlight 5 was in beta testing while this book was being written

  Before clicking OK to create the new login, click the ServerRoles option on the left and grant your service account the dbcreator and securityadmin roles so it can create and secure new databases when theconfiguration runs, and when running the SharePoint Central Administra- tion web site. If the developer creates the master page in SharePoint Designer or uploads it into the Master Page Gallery using a web browser, it is createddirectly in the content database and is only visible to the site collection where it was created.

Building a Web Part A good first project for SharePoint development is to build a web part

  Begin by setting up your development environment as described in Chap- ter 1, “Getting Started with SharePoint and Silverlight.” Log in to yourdevelopment machine as a server and SharePoint administrator and then open a web browser and visit the test SharePoint site you created at the endof the SharePoint installation. They can only use a subset of Building a Web Part the SharePoint API within the site collection where they are installed, and they can’t call out over the network or gain access to the servers wherethey run.

M

forms and can have different appearances. Often it’s video or a dynamic user experience that drives interest in web sites and gives devel-opers good reason to construct these applications. These applications are frequently called rich Internet applications (RIA). Although rich Internet applications often take over the entire user inter- face, including navigation and all layout elements, in SharePoint users gen-erally expect to use SharePoint as a basis for the user interface. This allows users to compose their own web user interfaces using web parts, page lay-outs, and navigation settings and to reuse the many assets included inSharePoint. Therefore, Silverlight solutions in SharePoint are generally small islands of RIA residing on a SharePoint page in a web part or else-where in the SharePoint user interface. This is the approach taken in this book. In the sections that follow, you learn how to create your own Silverlight applications and test them in a local web site in Visual Studio 2010. First,however, you learn how to put a Silverlight application on a web page. 79 Placing a Silverlight application on a web page begins by creating a Sil- verlight application package in a file ending with the .xap extension, whichis commonly pronounced “zap.” A .xap file is really a Zip archive, and if you rename one to end with a .zip filename extension, you can open it andlook inside. This can be helpful in learning Silverlight, as well as to under- stand what’s taking up space in an overly large .xap file. Web browsersdownload .xap files from web sites just like any other file, and they are cached just like other web files. The .xap file can be deployed to a web sitejust like any other. Typically, other than external data, everything a Silverlight application needs to run is contained within its .xap file. However, this isn’t nec-essary: The application can load additional code and resources (also in .xap files) after it has started running. This can reduce startup timeand also allow the browser to cache libraries that are used by multiple solutions. Dynamic .xap loading is covered in Chapter 8, “Accessing SharePointData with the Client Object Model,” where you learn to load the Share-Point client object model dynamically after your application has started up. After the .xap file has been created and placed on a web site for down- load, the next step is to place the Silverlight browser plug-in on a web pageand pass it the location of the .xap file to be rendered. An HTML : N ; tag, as shown in Listing 3.1, is used to instruct the browser to displaySilverlight. Placing Silverlight on a Web PageListing 3.1: Placing Silverlight on an HTML Page : $ F $; : N $ M < & &>($" $ < & &>$ $+GGQ$ $+GGQ$; : $ / $ / $ ) < GA $<; : $ = $ / $ ! = $ <; : $ 0 / $ / $ $ <;: $ 1/ I $ / $? G CG,>B G$ <; : $ / E $ / $ / $ <;: 6 $ M<< 6 <6 0<L 08 +?@+CBU ? G CG,>B G$ " $ & M $; :$ M<< 6 <6 0<L 08 +B+ADB$ $2 5 6 ! $ " $ & " M $<; :< ; :< N ;: 6 $3 3 "% $" $ "M MG MG MG $;:< 6 ;:< ; This example is taken from the code download for this chapter, in thefile Chapter03TestPage.aspx. When you create a new Silverlight project,Visual Studio 2010 offers to create a test web project, and this is from the test web page from the test project. The .xap file itself is placed in the Silverlightproject’s bin directory and is copied to the ClientBin directory in the test project to make it accessible on the test web site. It’s a best practice to use the test page that ships with Silverlight as a basis for placing Silverlight on a web page, given there are many nuancesin the HTML that can affect rendering in specific browsers. It’s safe to change the Silverlight parameters (the : ; elements), the : N ;tag’s height and width attributes, and the : ; attributes, but the rest of the markup should be copied exactly to ensure your solution works prop-erly in all web browsers. For example, the hidden : 6 ; tag ensures that navigation works in Safari. Notice the : ; tag and the image within it; this is what is rendered whenSilverlight is not installed. This default content shows an image, asking the user to download Silverlight and links to the download page. If you wantto override this logic, you can replace this with some other HTML. For example, rather than asking the user to download Silverlight, you couldprovide a simple HTML rendering of your solution. Table 3.1: Common Silverlight ParametersParameter Meaning/ E If true, Silverlight automatically upgrades to a newerversion if the currently installed plug-in is older than the 1/ I . 0 / The background color to show behind the Silverlightapplication. Allows the developer to pass a set of name/value pairs to the Silverlight application in the format, = A Javascript function to run if an unhandledexception is thrown in Silverlight. The Silverlight test application includes a good implementation of this. / The location of the Silverlight application .xap file. From a developer’s point of view, Silverlight is a subset of Microsoft’s Win- dows Presentation Foundation (WPF); indeed Silverlight began its life as“WPFe,” which is an acronym for “WPF Everywhere.” The idea was to build a simpler subset of WPF that would run in web browsers across plat-forms with the ambitious goal of eventually running everywhere. There are many advantages in this strategy, including significant reuse of code, tools(such as Visual Studio and Expression Blend), and developer expertise. Like WPF, a Silverlight application contains a combination of proce- dural code and a user interface markup in a language called XAML. XAMLstands for Extensible Application Markup Language and is an XML syntax for defining a WPF or Silverlight user interface. This approach is similar to Introduction to Silverlight Development

Building a Simple Silverlight Application with Visual Studio 2010

  After setting the text property to thecurrent date, it adds a couple of CSS styles to the label and adds it to the web part’s collection, making the a child of the ' . The easiest way to do this is to create some public propertiesin your web part and decorate them with attributes to let SharePoint know that it should save the properties and allow the user to edit them.

Dokumen baru

Aktifitas terkini

Download (610 Halaman)
Gratis

Tags

889 Professional Sharepoint 2010 Development 431 Using Microsoft Infopath 2010 With Microsoft Sharepoint 2010 Step By Step 757 Pro Sharepoint 2010 Governance 505 Sharepoint 2010 Business Intelligence 24 Hour Trainer Silverlight Framework 1173 Sharepoint Server 2010 Administration 24 Hour Trainer 1431 Microsoft Sharepoint Foundation 2010 Step By Step Ticket Reservation Using Silverlight 853 Silverlight 5 In Action 1574 Java Ee Development With Eclipse
Show more