Tag Info

Hot answers tagged

3

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"; ...


3

You can check the Template type of a web object. If it is APP#0 you don't need to add it to List. The example here shows how to get the web template. http://stackoverflow.com/questions/19382310/using-client-object-model-how-to-fetch-the-web-template-name-and-web-templat


1

The Features property only returns Features that have been activated. Web.Features property


1

Your OnSuccess must iterate the results: function onSuccess(sender, args) { var listItemEnumerator = items.getEnumerator(); while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); alert('ID: ' + oListItem.get_id()); } } Also, move the OnSuccess and OnFail inside of your main function ...


1

Finally i found my answer after lots of research. It was the problem related to Authorization, the SharePoint server which i wanted to refer, had a Form based Authentication. So i updated my code according to that and it worked fine. Please find my below updated code using (ClientContext spcontext = new ClientContext("siteURL")) { ...


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

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