Hi,
I am working with MOSS and attempting to run a custom Sharepoint program (.exe) from the command line on the SharePoint server. My main problem is the web <url> not found error when getting SPSite. So, I have tried to use the RunWithElevatedPrivileges(delegate() command and am getting an "Object Reference not set to an instance of an object" exception.
Does this mean that I don't have a service account, or something else entirely I've never seen this error before and from searching online, it does not seem to be a common error. The App Pool is running with "Network Service" under Identity and the service account being used has access to SharePoint, the database, and the website ala (http://www.sharepoint-tips.com/2007/04/content-query-limitations-and-object.html).
I think that this error from trying to run with ElevatedPrivileges is related to my FileNotFound error, so trying to tackle it one step at a time.
The failing bit of code is below. ServerAddress is a variable set to the siteurl(I checked).
SPSite spSite = new SPSite(ServerAddress);
The error that I get is this:
Exception in function Main. Message: The Web application at <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.
When I try to run with Elevated Privileges I get this(And from using debug messages it crashes on the SPSecurity.RunWithElevatedPrivileges(delegate() line:
Server Address: <URL> Exception in function Main. Message: Object reference not set to an instance of an object.
Thanks for any ideas or help you can offer. I appreciate it.
Kerby