Tag Info

Hot answers tagged

3

It seems it occurs since sp.js library that contains SP.ClientContext class is not yet loaded when your code runs. Use SP.SOD.executeFunc to ensure that the specified sp.js library is loaded when the code runs. Try to change ApproveRejectRDA function to enclose it in SP.SOD.executeFunc like this: function ApproveRejectRDA(id, approved) { ...


2

You have to specify the URL to new SP.ClientContext(url) From MSDN: var url = 'replace with server-relative or absolute URL'; var clientContext; var website; // Make sure the SharePoint script file 'sp.js' is loaded before your // code runs. SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady); // Create an instance of the client context for ...


2

As part of using AddFieldAsXml you need to provide the field's internal and staticname announcementy.Fields.AddFieldAsXml("<Field Type='User' DisplayName='Created By' StaticName='CreatedBy' Name='CreatedBy'/>", true, AddFieldOptions.AddToAllContentTypes); announcementy.Fields.AddFieldAsXml("<Field Type='DateTime' DisplayName='Date Created' ...


2

Return the results of your first call (which will be a jQuery Deferred object) then use that object with jQuery.when() in order to force all of the first calls to complete before the second one can begin: $('.littcls').each(function() { // *** use these variables to hold all of the promises you create in the loop var addTTItemPromises = [], ...


2

As a part of the new Minimal Download Strategy (MDS) the sp.js library is not loaded until explicitly called in SharePoint 2013. Solution Use SP.SOD.executeFunc function to ensure that sp.js library is loaded and then run the specified callback function: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){ //Your code goes here, for example ...


2

The syntax for loading Default View URL is below. context.load(lists,'Include(DefaultViewUrl)'); Default view is a valid list property and we need to explicitly load it.


2

Option 1. Get List by Url The below solution demonstrates how to retrieve List by its Url, it consists of two steps: Get List Folder using Web.GetFolderByServerRelativeUrl by specifying List Url Get List by specifying List id from Folder vti_listname property Code: '1 step. Get List Folder Dim listUrl As String = "/kb/Pages/" Dim listFolder As Folder = ...


1

Since List.DefaultViewUrl property is not loaded by default you have to include it explicitly as demonstrated below: var context = SP.ClientContext.get_current(); var lists = context.get_web().get_lists(); context.load(lists,"Include(Title, DefaultViewUrl)"); context.executeQueryAsync( function () { var e = lists.getEnumerator(); while ...


1

It could be an issue with this, since it changes scope when you use it in the delegates, try using var items= list.getItems(camlQuery) as you do in your first snippet: function getItemsWithCaml(listTitle) { //use of $.Deferred in the executeQueryAsync delegate allows the consumer of this method to write 'syncronous like' code var deferred = ...


1

Since Folder resource does not expose Content Type property I would recommend you to create Folder using SharePoint 2010 REST endpoint, in that case Content Type could be specified as demonstrated below: function createFolder(webUrl,listName,folderUrl,folderContentTypeId, success, error) { var urlParts = folderUrl.split('/'); var folderPath = ...


1

How to create Wiki page using SharePoint CSOM The example below demonstrates how to create wiki page via CSOM (VB.NET version): Sub CreateWikiPage(context As ClientContext, pageName As String, pageContent As String) Const templateRedirectionPageMarkup As String = "<%@ Page ...


1

It seems that sp.js is not yet loaded when SP.ClientContext is being called. Use SP.SOD.executeFunc to ensure that the specified file that contains the specified function is loaded and then runs the specified callback function. You could try to enclose your code like this: SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function() { var webUrl = ...


1

There is no built-in method in SharePoint CSOM API for copying Folder with Files from one location into another. The following solution demonstrates how to copy files from source folder into destination folder: public static class FolderExtensions { /// <summary> /// Copy files /// </summary> /// <param ...



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