Link to home
Start Free TrialLog in
Avatar of racineconde
racineconde

asked on

FileNotFoundException was unhandled by user code

I am trying to read documents from a SharePoint Foundation web site from a console application (I have the same error from an ASP .NET web application).

I get an "FileNotFoundException was unhandled by user code" error message. The detail of the message is:
************************************************************************
The Web application at http://win2008 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 is my code:
**************************************************************************************
            using (SPWeb oWebsite = new SPSite("http://win2008").OpenWeb())
            {
                string folderUrl = "Shared Documents";
                SPFolder oFolder = oWebsite.GetFolder(folderUrl);
                SPFileCollection collFile = oFolder.Files;

                foreach (SPFile oFile in collFile)
                {
                    Console.WriteLine(oFile.Name);
                 }
            }
***********************************************************************************

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of AlMothanaAlOmari
AlMothanaAlOmari
Flag of Jordan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of racineconde
racineconde

ASKER

The application is running on the Sharepoint server.
I've tried the modifications you (and the links you pointed me to) have suggested but I'm still getting the same error...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes I am.

I need to point out though that when \i tried to change the platform target, the only choice I had in the drop down list was "x86". The other options in the list were "<New>" and "<Edit>".
I created an "Any CPU" option and used it.
I had to do some other research to make this work