Tutorial by Examples

function getContentTypes(site_url,name_of_the_library){ var ctx = new SP.ClientContext(site_url); var web = ctx.get_web(); list = web.get_lists().getByTitle(name_of_the_library); // You can include any property of the SP.ContentType object (sp.js), for this example we are just ...
SP.SOD.executeOrDelayUntilScriptLoaded( function(){ deleteItem(1); }, "sp.js"); function deleteItem(id){ var clientContext = new SP.ClientContext(); var list = clientContext.get_web().get_lists().getByTitle("List Title"); var item = list.getItemById(id); it...
Creating List Items SP.SOD.executeOrDelayUntilScriptLoaded(createItem,"sp.js"); function createItem(){ var clientContext = new SP.ClientContext(); var list = clientContext.get_web().get_lists().getByTitle("List Title"); var newItem = list.addItem(); newIte...
SP.SOD.executeOrDelayUntilScriptLoaded(showUserInfo,"sp.js"); function showUserInfo(){ var clientContext = new SP.ClientContext(); var user = clientContext.get_web().get_currentUser(); clientContext.load(user); clientContext.executeQueryAsync(function(){ ...
SP.SOD.executeOrDelayUntilScriptLoaded(myFunction,"sp.js"); function myFunction(){ var clientContext = new SP.ClientContext(); var list = clientContext.get_web().get_lists().getByTitle("List Title"); var item = list.getItemById(1); // get item with ID == 1 ...
Basic Example Use the set_viewXml method of the SP.CamlQuery object to specify a CAML query to retrieve items. SP.SOD.executeOrDelayUntilScriptLoaded(showListItems,"core.js"); function showListItems(){ var clientContext = new SP.ClientContext(); var list = clientContext.get_...

Page 1 of 1