Tuesday, April 3, 2012

FileNotFoundException on new SPSite Call in SharePoint 2010

Today, I tried writing a console application to fetch some data from SharePoint for a report generation. Started with simple code, Ran it, Boom! Error: FileNotFoundException was unhandled. in spsite constructor!
filenotfoundexception spsite
Verified that the URL is valid and able to access. In fact, my code was quite simple.

SPSite site = new SPSite("http://sharepoint");
spsite filenotfoundexception sharepoint
Solution is simple! Go to Project Properties, change the platform target from x86 to x64 or any CPU. Also make sure the .Net framework is 3.5. Huh! once again made this silly mistake, Next time I'll take care.

Similarly, "Web application at URL could not be found" exception while accessing SharePoint site through object model may occur for the above cause!

It could be also because: Account has been locked!  In an another situation, this happened due to in-sufficient permissions (password expired).

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

1 comment :

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...