Exercise 1: Using the Content Editor Web Part
In this exercise, you will use the Content Editor Web Part to display a Silverlight application running on a different web site.
Task 1 – Hosting the Sample Silverlight Application in a Web Site
In this task, you will use Visual Studio to host the sample Silverlight application in a web site separate from the SharePoint web site.
- Using Visual Studio 2010, open the Sample.Silverlight.App.sln Visual Studio Solution at the following location <INSTALL>\Labs\CEWPSilverlightIntegration\Source\End \Sample.Silverlight.App.
- Once the solution is loaded, press F5.
Once the web browser is loaded and the sample Silverlight application is displayed, right-click in the address textbox and and select Copy. The path to the web page hosting the Silverlight application will be used in the next task.
Task 2 – Adding the Content Editor Web Part to a Page in a SharePoint Site
In this task, you will use Internet Explorer to add a Content Editor Web Part to a page in a SharePoint site.
- Open Internet Explorer and navigate to https://intranet.contoso.com.
Click the Edit button.
In the Editing Tools group in the ribbon, select the Insert tab.
- Select Web Part.
- In the Categories section select Media and Content.
- In the Web Parts section select Content Editor.
- Click the Add button.
Click the Save Button.
After the page is saved, mouse over the down arrow for the Web Part menu and select Edit Web Part.
Click the Click here to add new content link.
In the Ribbon, click the HTML button, and select Edit HTML Source.
Figure 7
Edit HTML Source
In the HTML Source dialog, enter the following HTML to display the Silverlight application you deployed uploaded in task 1.
<IFRAME SRC="<PATH TO WEB PAGE HOSTING SAMPLE SILVERLIGHT APPLICATION>" WIDTH="400" HEIGHT="300" />
Replace the <PATH TO WEB PAGE HOSTING SAMPLE SILVERLIGHT APPLICATION> placeholder with the value you copied from the web browser in task 1. To do this, highlight the placeholder text, right click, and select paste.
Figure 8
Paste the URL of task 1
After you paste in the new URL the code will look like this.
An IFRAME displays the web page from the web site that hosts the Silverlight application. In a scenario where the web site that hosts the Silverlight application requires separate credentials to authenticate you must enter the appropriate credentials to access the web site.
- Click OK.
In the Content Editor Web Part Toolpane, click OK.
Figure 10
Content Editor Toolpane
Notice the Content Editor Web Part displays the Silverlight.Sample.App Silverlight application on the SharePoint page.
Figure 11
Silverlight Sample Application into a Web Part