To return or get items from the list you have two options if you want to retrieve the single item you can use the GetItemById() method or for multiple items use GetItems(CamlQuery). Replace the siteUrl with your siteUrl for example ("xyz.sharepoint.com") and TitleOfList with your title list from which you want to get the items. Code to get the list item using the ID. function getListiem(){ var context = new SP.ClientContext(siteUrl); var list = context.get_web().get_lists().getByTitle('TitleOfList'); var targetListItem = list.getItemById(listItemID); context.load(targetListItem); context.executeQueryAsync(onGettingRecord, onFailedCallback); } function onGettingRecord(){ alert(targetListItem.get_item('Title')); } function onFailedCallback(sender,args){ alert('Request failed. ' + args.get_message() + '\n'+args.get_stackTrace()); } Code to get multiple items from the list. function getItems(){ var...
Techrobbers provides information related to Modern SharePoint, SharePoint Online, SharePoint Framework, Power Automate, PowerShell, PnP, Microsoft Teams and other things which are related to Microsoft 365.