Using SharePoint List Data in Microsoft Expression Blend
Posted by: Pravinkumar Dabade
in Category SharePoint
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 –
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 –
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;
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 –
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 -
You will be prompted to enter the data source name and browse the XML file as shown below -
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 -
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.