Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Posting to SharePoint list from seperate public website

  Asked By: Alec    Date: Mar 11    Category: MOSS    Views: 1677

I am currently trying to get a ASPX page from our public website (non
sharepoint) to collect information from a feedback form and create a
list item within our SharePoint Intranet (Moss 2007 site) for our
internal teams to view the request.

I have found the following code in the WSS3 SDK and modified the
values in the example to use my sharepoint url and list name but am
getting a "Object reference not set to an instance of an object"
error on the Dim destList As SPList = site.AllWebs
("" target="_blank" rel="nofollow">extranetdev.clearsprings.co.uk/.../i>" target="_blank" rel="nofollow">extranetdev.clearsprings.co.uk/.../i>").Lists
("Cornwall Service Users") Line.

Here is the code.

Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.WebControls
Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnSubmit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSubmit.Click

Dim site As SPSite = SPControl.GetContextSite(Context)
Dim destList As SPList = site.AllWebs
("" target="_blank" rel="nofollow">extranetdev.clearsprings.co.uk/.../i>" target="_blank" rel="nofollow">extranetdev.clearsprings.co.uk/.../i>").Lists
("Cornwall Service Users")
Dim listitems As SPListItemCollection = destList.Items
Dim item As SPListItem = listItems.Add()

item("SU Name") = txtbxTitle.Text & " " & txtbxFirstName.Text
& " " & txtbxSurname.Text
item("Address") = txtbxAddress.Text
item("Contact Number (Home)") = txtbxHomeNumber.Text
item("Contact Number (Work)") = txtbxWorkNumber.Text
item("Contact Number (Mobile)") = txtbxMobile.Text

item.Update()

End Sub
End Class

I am normally an Administrator not Developer, and am alittle out of
my depth.

Any help or suggestions would be appreciated

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Kristy Hicks     Answered On: Mar 11

I don't think your .aspx page  on your public  web server has the "context" of
your WSS 3.0 site. You may want to consider capturing the form  input into a
database and then using a dataview web part on your site. If you are running
MOSS Portal then you may be avble to do what you want using a Business Data
Catalog.

 
Answer #2    Answered By: Alisha Itagi     Answered On: Mar 11

You can't use the
Dim site As SPSite = SPControl.GetContextSite(Context)
statement on code that runs outside the context of the site collection that
you want to manipulate.

If your non-SharePoint site is running on the same machine as your MOSS
installation then you can use the object model's other methods to get ahold
of the SPSite object. However, if you are not on the same machine as the
MOSS installation then you cannot use the object model. You will have to
use the Lists web service that Paul Stork mentions.

 
Answer #3    Answered By: Carey Everett     Answered On: Mar 11

I am going to give the lists.asmx webservice a try.

 
Answer #4    Answered By: Anuj Lakhe     Answered On: Mar 11

Instead of using the object model take a look at the methods available in
the lists.asmx webservice. If memory serves me you can use this to add
items to a list  and then would not have any dependencies on the site running
the page  having access to the SharePoint object model. For what you want to
do it will probably much easier. Using Webservices you could even have a
PHP based website  on a UNIX box adding items to a list.

 
Answer #5    Answered By: Brandon Kirk     Answered On: Jun 14

On SharePoint you want to create web application in central administration.

Next find authentication providers, followed by selecting enable anonymous,
and save.
Find web application management, select site, under anonymous policy, check deny write.

Simple orders to follow to Navigate to Site:
1. Choose Site Action
2. Select Site Setting
3. Select Site Permissions
4. And then click Anonymous Access, followed by Entire Website, then OK.


Now close all browsers and go back into the website again. Once back in if you did everything correctly you will be browsing as anonymous!

Shawn Zernik
www.internetworkconsulting.net

 
Didn't find what you were looking for? Find more on Posting to SharePoint list from seperate public website Or get search suggestion and latest updates.




Tagged: