Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

Sharepoint List Data Entry

I would like to see an example of code which could be embedded in html that would enter data into a simple sharepoint list.  For example if the fields were: Title, Date, Comments.  Be aware that I don't have access to 2007 designer.  I would like to create a custom interface to enter data.  With a simple example I could see the methodology to create my own custom solution.
Thanks
0
bvanee1
Asked:
bvanee1
  • 2
  • 2
  • 2
1 Solution
 
66866Commented:
You'll have to use the Sharepoint Object Model. Create a reference to the Sharepoint DLL in your project.
In your code behind, create variables that create an instance of the Sharepoint site, web and list

dim spSite1 as new spsite("rootsite")
dim spweb1 as spweb=spsite.openweb("yoursubsite")
dim spyourlist as splist=spweb.lists("your list")
dim newitem as splistitem=spyourlist.add

add the item to your list using the code below
using spsite1
using spweb1
newitem("Title")=yourvalue
newitem("Date")=yourvalue
.
.
spweb1.AllowUnsafeupdates=true
newitem.update
spweb1.AllowUnsafeupdates=False

end using
end using

That's it !!
0
 
bvanee1Author Commented:
I might need some more help...still not getting it.  Let me give some more information.
URL to List: http://sharepointABC.com/fieldlocations/YYY/test/Lists/testlist/AllItems.aspx
The list contains one field: Title
I would like to add this code to a Content Editor Web Part with contans HTML.
Thanks
0
 
66866Commented:
It's not possible to do this in Content Editor Web Part. You will have to create a custom webpart in Visual studio that can do this.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
Ted BouskillSenior Software DeveloperCommented:
Sharepoint Designer 2007 is now free and perfect for this.  Are you not allowed to use it?
0
 
bvanee1Author Commented:
Right, it is a government network and they have restricted access to designer.  Working on it though.
0
 
Ted BouskillSenior Software DeveloperCommented:
It's not a dangerous product.  Only site owners or site designers are allowed to use it on Sharepoint.  So, as long as your Sharepoint permissions are configured properly it's not dangerous.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now