Tag Info

Hot answers tagged

1

I have corrected your code and here you go $(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(GetDesc, "sp.js"); }); function GetDesc() { context = new SP.ClientContext.get_current(); web = context.get_web(); siteURL=$(location).attr('href'); var titleName=document.title; var mListName= "TestList"; ...


1

Updating a list item in JSOM should be as simple as this: function updateListItem(itemId) { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('My List'); this.oListItem = oList.getItemById(itemId); oListItem.set_item('MyField', 'My Updated Field Value'); oListItem.update(); ...


1

Refer updated code. olist.update(); ctx.load(olist); Is update to below this.oListItem.update(); ctx.load(this.oListItem); So the update function looks like below. function dooperation(retvalue){ var ctx = new SP.ClientContext(url); var olist = ctx.get_web().get_lists().getByTitle('userlist'); var ...


1

The REST API url needs to have the site url with full /sites/BusinessServices/ etc. https://TENANT/sites/HomePortal/_api/web/GetFileByServerRelativeUrl('/sites/HomePortal/Pages/ProductInfo.aspx') And then need the personalizationscope when getting webparts : ...


1

You can easily create a list item with managed meta data field as : function createaListItem() { var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('Listname'); var itemCreateInfo = new SP.ListItemCreationInformation(); this.oListItem = oList.addItem(itemCreateInfo); ...


1

I have used below JavaScript function to get login name of current logged in user. While working on this code, it was noticed that get_loginName() function brought i:0#.w|DomainName\asad. So I have used string manipulation to get the desired one i.e. DomainName\asad function getCurrentUser() { try { var clientContext = new ...



Only top voted, non community-wiki answers of a minimum length are eligible