Using SharePoint List Data in Microsoft Expression Blend

Posted by: Pravinkumar Dabade , on 5/26/2011, in Category SharePoint
Views: 85610
Abstract: In this article we will see how to fetch SharePoint List data and generate an XML file. We will then use this XML file as a ‘Sample Data’ in Microsoft Expression Blend for our Silverlight Application.

In this article we will see how to fetch SharePoint List data and generate an XML file. We will then use this XML file as a ‘Sample Data’ in Microsoft Expression Blend for our Silverlight Application. For this demonstration, we will have to first create a SharePoint site. The steps to create a SharePoint Site using a Team site is the same as shown in my previous article SharePoint Dashboard with Common Filters using PerformancePoint Services 2010. Once your site is ready, let’s create a SharePoint custom list with the name ‘Customers’ and add the following fields as shown below –

Sharepoint custom list

Now we will generate a XML file which will contain the list data in form of XML using SharePoint Client Object model.

 

So let’s create a Console application with the name ‘GenerateXMLData’ and write code as shown below – First add a reference to the following DLL files in our Console application –

  1. Microsoft.SharePoint.Client.dll.
  2. Microsoft.SharePoint.Client.Runtime.dll

You can find these DLL files under – ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI’. Now import the following namespaces in our Program.cs file – using Microsoft.SharePoint.Client; using System.IO;

sharepoint-xml-generate

Hit ‘F5’ to run the application and you will see the XML file generated on your ‘C:\’. Now let’s design the Silverlight application using Microsoft Expression Blend and name it as ‘DisplaySPSampleData’ as shown below –

Expression Blend Project

Import the XML file which we just created in the above steps. Go to 'Data' window in Blend and click on 'Create Data Sample' arrow and click on 'Import Sample Data from XML' as shown below -

Expression Blend Import Sample Data

You will be prompted to enter the data source name and browse the XML file as shown below -

Blend Sample XML Data

You will see all the columns of 'Customers' list which we chose during creation of our XML files. Now drag and drop 'CustomerName' field on the MainPage.xaml as a Listbox. Click on the 'Details Mode' and drag and drop CustomerID, CustomerName, City, Country and JoiningDate on the form to show the details as shown below -

clip_image004

Now hit 'F5'to run the application and see how Master-Details data is shown in the browser with SharePoint data.

Conclusion - In this article, we have seen how to fetch SharePoint List data and generate an XML file. We have then used this XML file as ‘Sample Data’ in Microsoft Expression Blend for Silverlight Application.

Give me a +1 if you think it was a good article. 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
Comment posted by Macit on Sunday, August 28, 2011 1:25 PM
It would be helpful to include the source code for the article.
Comment posted by Macit on Sunday, August 28, 2011 1:26 PM
It would be helpful to include the source code for the article.
Comment posted by Tarun Vats on Wednesday, December 18, 2013 2:13 AM
Nice and useful Article..

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