SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi there I'm trying to access a SharePoint 2007 site with VSTA and InfoPath 2007

On this line of code:

Dim aSite As String = "http://win-gqnf6n2p9dt/Sites/ESP"
WxJobSite = New SPSite(aSite)

It generates the following exception:

The Web application at http://win-gqnf6n2p9dt/Sites/ESP 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.


at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken) at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at edit_form.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e) in C:\Users\Administrator\Documents\InfoPath Projects\edit form1\FormCode.vb:line 68"

Now then the Web Application in question exists, I've checked through my browser. I've checked my URL mappings and they look fine. The Web Application is on the same computer as my VSTA and InfoPath form that I'm debugging, and any other alias to the url (LocalHost,,etc) would return the same error. The Web App account is set to Administrator, and I'm logged in as Administrator (it's a dev server, no biggie).

I just can't seem to figure out what is going on, thoughts?

share|improve this question
up vote 0 down vote accepted

Figured it out, before opening a SPSite object in Infopath, the form needs to be published and viewable in SharePoint.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.