FileNotFoundException on new SPSite Call in SharePoint 2010
Today, I tried writing a console application to fetch some data from SharePoint for report generation. Started with simple code, Ran it, Boom! Error: “FileNotFoundException was unhandled” in spsite constructor!
Verified that the URL is valid and able to access. In fact, my code was quite simple.
SPSite site = new SPSite(“https://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 another situation, this happened due to insufficient permissions (password expired).
One thought on “FileNotFoundException on new SPSite Call in SharePoint 2010”