Problem Statement
Insert an item into a SharePoint list by using the JavaScript Object Model (JSOM).
Solution
Note
Use the attached document for graphical representation.
Step 1
Create a SharePoint List named “Login Details”.
Step 2
Go to setting and create a column named "UserName", as shown in the below table.
Step 3
Create a second column as "Password".
|
sr no
|
Column Name
|
Column Type
|
|
1
|
UserName
|
Single Line of text
|
|
2
|
Password
|
Single Line of text
|
Step 4
Add a new page to the site – To add a new page, click on the gear icon on the top left side of the page and click “Add a Page”.
Step 5
Name the page as “JSOM” and click "Create".
Step 6
The JSOM page will open in edited mode. Click on Insert >> Media and Content >> Script Editor, as shown below and click on the "Add" button.
Step 7
Click on "Edit web part" and then, click on "Edit snippet".
Step 8
Paste the following code in the code editor window.
a. Be careful to insert your home site URL in the below code.
var siteUrl = 'your site.com/teams/Yout site';

Join the conversation! Your thoughts help the community grow.