| By Corey Roth | Article Rating: |
|
| August 3, 2009 09:00 PM EDT | Reads: |
2,218 |
I needed to do a quick proof of concept of displaying search results in Silverlight recently and it actually proved easier than I thought it was going to be.
I tried this once before in a beta version of Silverlight 2 and it was much more difficult at the time.
I was able to easily add the reference to the search web service but the proxy was filled with classes that were not supported in the Silverlight .NET Framework. This time I was relieved to find that it was much simpler. I’ve written many applications to query using the web service, so the first thing I thought of was how is this thing going to authenticate to SharePoint. I started doing tons of unnecessary research when I should have just written some code.
When you create a reference to the web service, you do not have a credentials property you can set like you could in a regular .NET application. It turns out that it just works provided you do all of the other necessary things to call a web service first in Silverlight.
For the purpose of today’s post, we are going to assume that whatever page is hosting the Silverlight application is running under an account that can access SharePoint (i.e.: Cassini or from SharePoint itself). I started by creating a reference to the web service at the usual location (/_vti_bin/search.asmx).
I thought I would need to mess with the security element in the ServiceReferences.ClientConfig file, but in fact you can just leave it alone. The next thing you have to do is create a cross-domain policy file so that Silverlight knows it has permission to call the web service. Here is what the file, ClientAccessPolicy.xml, looks like. You can customize it for your needs of course.
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Creating the file is quite simple, but you need to get the file into SharePoint. This file has to be located at the root of the web application (not site or site collection). Of course since it is SharePoint, you can’t just go and drop the file into the 80 folder in wwwroot. So I found, one of the easiest ways to add the file is using SharePoint Designer. Open it up, connect to your site, and then drag the file onto the root of your site (or create a new one from the menu). When you are done, it should look something like this.
Read the original blog entry...
Published August 3, 2009 Reads 2,218
Copyright © 2009 Ulitzer, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Corey Roth
Corey Roth is a consultant at Stonebridge specializing in SharePoint for clients in the energy sector. He has more than ten years of experience delivering solutions in the energy, travel, advertising and consumer electronics verticals.
Corey specializes in delivering ECM and search solutions to clients using SharePoint. Corey has always focused on rapid adoption of new Microsoft technologies including Visual Studio 2010, .NET Framework 4.0, and Silverlight.
He is a member of the .NET Mafia (www.dotnetmafia.com) where he blogs about the latest technology and SharePoint. He is dedicated to the community and speaks regularly at user groups and SharePoint Saturdays.
- Iron Mountain Buys Mimosa
- Rackspace Puts Microsoft SharePoint in the Cloud
- Silverlight in SharePoint 2010
- Microsoft and Intuit to Deliver Web Applications to Small Businesses
- Day Delivers 65% License Growth for 2H 2009
- Cloud Replication Is Not Backup, But Backup Is!
- EMC Achieves Record Fourth-Quarter Revenue Ahead of Company Expectations
- Leveraging LinkedIn for Business Networking and Career Development
- Loyalty Programs Dole Out Rewards but Fail to Fully Connect With Consumers Says New CMO Council Study
- Metalogix Migrates Oracle Content Server Content Types to SharePoint
- CommVault Ships Cloud-Optimized Simpana Software
- Hubspan to Launch New SciQuest Integration Connectors
- Microsoft’s First Step Toward Cloud Computing
- Iron Mountain Buys Mimosa
- Behind the Scenes, SANta Claus Global Cloud Story
- Does Cloud Computing Exacerbate Security and File Transfer Issues?
- HyperOffice Released Beta Cloud Computing Software
- Zebras, Giraffes, and Horses
- Rackspace Puts Microsoft SharePoint in the Cloud
- Alfresco Brings Lotus Users Open Source Content Management Platform
- Silverlight in SharePoint 2010
- Feature Versioning and Upgrades in SharePoint 2010
- Avoid the Seven Common Software Marketing Mistakes
- Microsoft and Intuit to Deliver Web Applications to Small Businesses
- Microsoft’s First Step Toward Cloud Computing
- Open Source Selenium Web Application Testing System
- Amazon Web Services Database in the Cloud
- Unisys Provides Mobile Support
- HP Acquires Cloud Computing Company
- Visual Studio 2010 Is Cloud Friendly
- Iron Mountain Buys Mimosa
- Behind the Scenes, SANta Claus Global Cloud Story
- Is IBM XIV Still Relevant?
- Calling the Enterprise Search Web Service from Silverlight 3
- Hosting.com Launches ColdFusion 9 in the Cloud
- Salesforce.com Unveils Service Cloud 2






























Ulitzer content is offered under Creative Commons "Attribution Non-Commercial No Derivatives" License.
For any reuse or distribution, you must make clear to others the license terms of this work.
The best way to do this is with a link to this web page.
Any of the above conditions can be waived if you get written permission from Ulitzer, Inc., the copyright holder.
Nothing in this license impairs or restricts the author's moral rights.