views:

32

answers:

2

I have a Silverlight 4 Beta application where I'd like to use the SharePoint object model to upload a document to a SharePoint site - should be simple enough, except an exception is thrown at:

using (SPSite siteCollection = new SPSite(siteCollectionUrl))

The Web application at http://intranet.fabrikam.com could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

This particular exception is actually really well documented out there, it's obviously masking a real underlying issue. Here are some of the things I've read about and tried without success:

DNS / Host Header: This exception occurs when the particular URL isn't in the IIS metabase because it's being handled by DNS. My web application has an AAM set up and a host header on the web site in IIS. I also tried running the code without using the FQDN of the site, e.g. http: //servername:4860.

Permissions: The identity of the the Silverlight application pool has db_owner permissions to my content database, and is also a site collection administrator. I can't have both web sites use the same application pool because the Silverlight application needs to run in a .NET app pool.

x86 vs x64: My Silverlight application has to be compiled for x86 - I'm using some controls that only work in x86. The installed SharePoint version is x64. I've read about people seeing this exception when trying to use the SharePoint object model to hit a x64 SharePoint installation from a x86 app.

Adding then removing permissions for the account: This begins to border on some voodoo magic, but I read about people magically resolving this issue after removing the permissions they set trying to troubleshoot this problem initially. No luck here.

Would appreciate any suggestions, thank you!

+2  A: 

Silverlight runs on the client/browser, not on the server - so the server-side SharePoint object model will not be available to you.

However, there is an object model for SharePoint 2010/Silverlight apps - see this MSDN article for details.

Greg Hurlman
Greg, I'll give that a shot and report back. Don't know why I didn't even think of the Client Object Model ...
George Durzi
A: 

Hi there, If you want to use SharePoint objects in Silverlight then it's the time to use Silverlight Client Object model. You can access whatever you want to load the data from SharePoint 2010 server. This is the one of the great advantages with SharePoint 2010. We can do everything with client object model concept. We just need to copy the client dlls to the development server to access SharePoint server.

For Silverlight client object model details, here is the great start and examples. SharePoint 2010 - Silverlight Client Object Model - How to use

For Silverlight Client object model information: Client Object Model

-Praveen

Rare Solutions