Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

StackTrace:

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, 127.0.0.1,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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.