SharePoint API: new SPSite(), throws error

No comments

When you are making a Console Application and you are using SharePoint API, sometimes when you are creating a new SPSite object you may receive an error, which says that the site is not found.

You have to check a couple of things:

– In the properties of the project, at Build section, set Platform target to: Any CPU
– If that is not working, make sure that the user under which console application is running, is owner of database SharePoint_Config.

Hope that helps.

Leave a comment