Accessing a share point site using the object model.

Posted by Prashanth on Stack Overflow See other posts from Stack Overflow or by Prashanth
Published on 2010-04-16T11:40:25Z Indexed on 2010/04/16 11:43 UTC
Read the original article Hit count: 242

Filed under:

Hi

I am trying to access a share point site using the SP object model from a console application.

I am trying to do something like this..

SPSite site = new SPSite(sitePath)

//Operations go here

This works fine when the share point site and the console app are on the same machine.

However when the console app and the site are on different machines, I get an error "The Web application at "http://server/url" 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"

Here are the things that I have already done:

1) I have tried accessing the site via both IP address as well as machine name, assuming that it could be a DNS resolution issue.

2) Initially I impersonated using a farm admin account, still i could not access. Then I added myself as the farm admin, still no joy.

4) The site is accessible via IE. So it is not a permission issue I guess.

5) I have tried almost all the solutions suggested by various links obtained by googling the error message.

I am trying this on share point 2010. A similar issue occurs on 2007 also. Sometimes its kind of frustrating to do SharePoint development , since I get the feeling of stumbling from one error to the next, with no clue as to what could be wrong and the error messages not being helpful in the least :(

© Stack Overflow or respective owner

Related posts about sharepoint-api