views:

453

answers:

1

I'm building a Silverlight application that interfaces with SharePoint Web Services. In a windows forms application I'd create a web reference to my local SharePoint server, then change the Uri of the reference at runtime to point to whatever SharePoint site I wanted to use. Silverlight doesn't seem to have web references, but similar functionality can be achieved with service references. However, there doesn't seem to be a way to change the Uri of the reference at runtime. Is there a way to do this in Silverlight? Or a better way of using SharePoint web Services from Silverlight?

Note: I need to access list item attachments, so owssvr.dll won't be sufficient (I think?)

+2  A: 

Seeing as you are using WCF (to reference the Service), you can change the Address of the service like so:

MyServiceSoapClient soapClient = new MyServiceSoapClient();
mySoapClient.Endpoint.Address = new EndpointAddress(URI]);
// do call here
Colin