SharePoint 2010 and Silverlight Out-Of-Browser with COM Interop – Part IV

Posted by: Pravinkumar Dabade , on 5/20/2011, in Category SharePoint
Views: 76889
Abstract: In this article, we will see how to fetch SharePoint lists data in Silverlight Out-Of-Browser applications. We will then deploy this data into an Excel application, using COM Interop, which is a feature of Silverlight 4.0.

In this article, we will see how to fetch SharePoint lists data in Silverlight Out-Of-Browser applications. We will then deploy this data into an Excel application, using COM Interop, which is a feature of Silverlight 4.0.

 

The first step is to create a Silverlight application which will fetch the data from SharePoint Lists. I have already demonstrated how to fetch the SharePoint list data in Silverlight in, my previous articles – Silverlight Client Object Model in SharePoint 2010 – Part III and Read SharePoint 2010 List in Silverlight using REST – Silverlight with SharePoint 2010 – Part II. For this demonstration I am using the same demo which I have demonstrated in my previous article – Read SharePoint 2010 List in Silverlight using REST – Silverlight with SharePoint 2010 – Part II.

 

In this demonstration, I have made few changes in the Silverlight application as shown below –

clip_image001

The change is quite simple. I have added one button with the title ‘Write To Excel’. I have also done a couple of changes in the properties of Silverlight project so that my Silverlight application can run out of the browser. The steps are as shown below –

  1. Right click the Silverlight application and go to properties.
  2. Check the check box – ‘Enable running application out of the browser’.
  3. Click on the ‘Out-of-Browser settings’ button and check the check box ‘Require elevated trust when running outside the browser’.

Now add a reference to the ‘Microsoft.CSharp.dll’ file which you can find here – ‘C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client’.

Add some code in the click event of the button ‘Write To Excel’ as shown below –

Silverlight Write to Excel

 

Now let’s build and deploy the application using SharePoint Solution with Visual Studio 2010. The steps to deploy and test the application using Visual Studio are available in my article – Deploy Silverlight Application using SharePoint 2010 Project

Once you deploy the project, test it as shown in the above article. If you right click the application, you will see a menu to install the Silverlight application. Click on ‘Install application on to this computer’ as shown below –

Sharepoint Silverlight COM

Once you install the application, it will open the application as a desktop application. Type ‘I’ and click on ‘Search’ button and it will show you the result as shown below –

Sharepoint Silverlight COM

Now click on the button ‘Write To Excel’ and it will open an Excel workbook with the above data as shown below –

Sharepoint Silverlight COM

Summary – In this article, we have seen how to fetch the data of SharePoint lists in Silverlight Out-Of-Browser application. We then deployed this data into an Excel application using COM Interop, which is a feature available in Silverlight 4.0.

The entire source code of this article can be downloaded over here

Give a +1 to this article if you think it was well written. Thanks!
Recommended Articles
Pravinkumar, works as a freelance trainer and consultant on Microsoft Technologies. He is having over 10 years of experience in IT and is also a Microsoft Certified Trainer(MCT). He has conducted various corporate trainings on all versions of .NET Technologies including .NET, SharePoint Server, Microsoft SQL Server, Silverlight, ASP.NET, Microsoft PerformancePoint Server 2007 (Monitoring). He is passionate about learning new technologies from Microsoft. You can contact Pravinkumar at dabade[dot]pravinkumar[attherate]gmail[dot]com


Page copy protected against web site content infringement by Copyscape


User Feedback

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel