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(folderU rl);
SPFileCollection collFile = oFolder.Files;
foreach (SPFile oFile in collFile)
{
Console.WriteLine(oFile.Na me);
}
}
************************** ********** ********** ********** ********** ********** *******
Thanks!
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(folderU
SPFileCollection collFile = oFolder.Files;
foreach (SPFile oFile in collFile)
{
Console.WriteLine(oFile.Na
}
}
**************************
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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 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.
ASKER
I had to do some other research to make this work
ASKER
I've tried the modifications you (and the links you pointed me to) have suggested but I'm still getting the same error...