Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to Access Sharepoint Webs on remote machine with spsite() with

  Asked By: Norma    Date: Sep 10    Category: Sharepoint    Views: 3055

I am working with VB .Net 2003 and building a console application
that is running on our Sharepoint Server. I have VB installed on
the server and everything compiles and works as expected if I
use "http://localhost/sites/test" for the URL parameter strURL in
the following code sample.

Dim siteCollection As New SPSite(strURL)
Dim sites As SPWebCollection = siteCollection.AllWebs
Dim site As SPWeb

Dim i As Integer
i = sites.Count
Catch ex As Exception
VerifyURL = False
Exit Function
End Try

But, when I change the URL to "http://Sharepoint/sites/test", I get
the following error message:

"The server instance specified was not found. Please specify the
server's address and port", error 5

It appears that I can only access a sharepoint site via the
localhost. Should I be able to access a sharepoint site by URL?
And if so how? Does anyone have a code sample.



1 Answer Found

Answer #1    Answered By: Joanne Greer     Answered On: Sep 10

You can only access  servers on the same machine  using the OM. If "sharepoint"
is the local hostname, then you probably need to add it to the Alternate Access
URLs list.