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?

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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