the Web application at "http://sharepoint" 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.
I am developing and running the infopath form on the web server as sharepoint admin. The form has full trust. I am most certain that I am using the correct URL. It works in powershell just not in code behind.
can someone verify my code? Thanks
My code:
//set string var
string assignedTo = "";
string modifiedBy = "";
string modifiedDate = "";
//query SP List and Get Data
SPSite spSite = new SPSite(http://sp-wfe);
Using (SPWeb spWeb = spSite.OpenWeb(http://sp-wfe/subsite))
{
SPList spList = spWeb.Lists["Tasks"];
SPQuery spQuery = new SPQuery();
SPListItemCollection collection = spList.GetItems(spQuery);
SPListItem spListItem = collection.GetItemById(3);
assignedTo = spListItem["Assigned To"].ToString();
modifiedBy = spListItem["Modified By"].ToString();
modifiedDate = spListItem["Modified"].Tostring();