none
Programmatically access remote sharepoint site RRS feed

  • Question

  •  

    Hi All,

     

    I am very new to Sharepoint and ASP.NET programming and therefore I am stuckd at the first steps. I would like to create a simple ASP.NET webapp - a simple form -  running on one (public) server and posting data to a Sharepoint list on another (private) server which runs SPS 3.0.

     

    When the user on the webapp's form press the OK button, I try to access the the sharepoint site like this :

     

    protected void btnOK_Click(object sender, EventArgs e)
    {
       SPSite mySite = new SPSite("http://remoteserver/site");

      ...

    If I wnat to access a SP site on the local server on which I develop, it works. However, connecting to a remote server fails with FileNotFoundException and the following  message :

     

    "The Web application at http://remoteserver/site 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 do not know what's wrong with it, can somone explain me ?

     

    Thanks,

    Laszlo

    Thursday, April 10, 2008 9:27 AM

Answers

All replies

  • I have had the same problem, but trying with a Windows Forms app.  I have not found out whether there is a way to get round this directly.  I have suspected that the problem has to do with authentication on the remote site.

     

    My proposed solution is to use Web Services from the remote site, which require authentication.

    Thursday, April 10, 2008 10:11 AM
  • Hi Mike,

     

    I also suspected this might be an authentication issue but then I think there should a SecurityViolationException be thrown, not a FileNotFound exception ?!

     

    Regards,

    Laszlo

     

    Thursday, April 10, 2008 10:24 AM
  • You probably won't be able to use the WSS object model classes to access the remote server unless the server your code runs on is joined to the same SharePoint farm.

     

    Your best alternative is to use the SharePoint web services or RPC methods to post data to the list.

     

    Option 1: Call UpdateListItems() in the Lists.asmx web service:

    http://msdn2.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx

     

    Option 2: Post data using the RPC protocol (Save method):

    http://msdn2.microsoft.com/en-us/library/ms463030.aspx

    http://msdn2.microsoft.com/en-us/library/ms455433.aspx

     

    Thursday, April 10, 2008 12:41 PM
  •  

    Hello David,

     

    thank you for your answer. I just have found some articles about using sharepoints's web services to manipulate lists and so I concluded the same.

     

    I am going to try this and hope it helps.

     

    Thanks,

    Laszlo

    Thursday, April 10, 2008 12:48 PM