Hot answers tagged

12

Modify var camlQueryString = "<Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query>"; to var camlQueryString = "<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>{ADD LIST ITEM ID HERE}</Value></Eq></Where></Query></View>";


6

This web part has already been created. but read General thoughts on a modern script editor webpart before you use it.


4

I give you a example where you can view what are the files you need to use sp.js http://todosharepoint.blogspot.com.ar/2014/08/que-librerias-necesitamos-para-poder.html


3

This is actually quite a known issue when trying to fetch the User profile photo and binding it to the html in other sharepoint page. To fix, we used the userphoto.aspx layouts page which helped us fix the issue. So, in your code, you need to form the url as below: https://sitecollectionurl/_layouts/15/userphoto.aspx?size=L &accountname=...


3

Following the comment from Akhoy, the solution that worked for me was to modify the masterpage header to explicitly load the sp.js library, using this piece of code: <SharePoint:ScriptLink ID="ScriptLink21" Name="sp.js" runat="server" OnDemand="false" LoadAfterUI="true" Localizable="false" /> Just put it inside the header section.


3

You have missed <Eq></Eq> try following query <View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>234</Value></Where></Eq></Query></View> Or If you want to get Item using ID Instated of caml Query getItemById() method. Try following code. function queryListItems(...


3

<button id='btnGetSites'>Get Sites</button> <div id='list'> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script> <script type='text/javascript'> (function(){ var siteUrl = _spPageContextInfo.siteAbsoluteUrl; var url = siteUrl + "/_api/search/...


2

I'm guessing your are trying to get items from a library, and you are trying to get the name: thisCurrentName = currentItem.get_item('Name'); The internal name of that column is not Name , you could try FileLeafRef


2

Here is the final product. Subsites are only loaded when a user clicks on the '+' ENJOY! In Visual Studio create a Farm Solution. Make it a Visual Web Part. Create a Class titled. SitesList. add these getters and setters. class SitesList { public int SiteCollid { get; set; } /// a counter to give the css class for uniqueness public string SiteUrl ...


2

Set CAML query to camlQuery.set_viewXml() like below, var oList = oWeb.get_lists().getByTitle('DS_HaveYouMet'); camlQuery.set_viewXml("<View><Query><Where>" + "<Eq>" + "<FieldRef Name='scriptIndex' />" + "<Value Type='Text'>" + ...


2

a.download is not supported in IE and Mozilla browser.


1

Try your query like this: <Query> <Where> <Eq> <FieldRef Name="internalFieldName"/> <Value Type="Lookup">value</Value> </Eq> </Where> <OrderBy> <FieldRef Name="internalFieldName" /> </OrderBy> </Query> Default lookup ...


1

It looks like rootWeb is out of scope in your OnQuerySucceed function. When you first define it using var, it is in the scope of your getRootWeb function. When you call this.rootWeb it is looking for a rootWeb variable with global scope. Change the line where you first define rootWeb to use this: this.rootWeb = site.get_rootWeb();


1

Please try below code to get multiple User from list column var itemId = 1; // Item ID var targetListItem; // List variable function getItemByID() { var clientContext = new SP.ClientContext(); var targetList = clientContext.get_web().get_lists().getByTitle('{List Name}'); //SET list name here targetListItem = targetList....


1

ExecuteOrDelayUntilScriptLoaded(functionToExecute, JavaScriptFileName) The above function accepts two parameters A function name Script file name functionToExecute will be run only after the JavaScriptFileName is loaded. This way you can be sure the function that is internally used is available. Example - Retrieve list items uses client object functions ...


1

SP.js is the default and mandatory reference file of SharePoint Client side object model. You can use this file to write JavaScript(ECMAScript) codes in web part pages or application pages by referencing the javascript file - "SP.JS". In your code, you have already declared the file in your code in the document.ready event, and hence, you do not need to ...


1

The solution was simple. When the window pops out, press pause in debugger. When debugging a unit test using Visual Studio, Debug.Assert failure does not pop up a window, it's like the test framework has removed this feature. (I'm using VS 2013 Pro.) Try if you are using in web part: Make sure to edit the page and then edit the web part. Edit current ...


1

For those who just want a full list of sites the user has access to, find the below rest code using /_api/search/query?querytext='(contentclass:STS_Web)'&rowlimit=500&selectproperties=%27Url,Title%27 Read more here


1

Its failing because the scope of the variable allItems is inside the runOnSuccess function. Replace it as below: clientContext.load(allItems, 'Include(hymDisplayName)'); //clientContext.executeQueryAsync(runListQuery,function() { alert('List get failed'); } ); clientContext.executeQueryAsync(function(){ var listEnum = ...


1

Looks like this is Hyperlink or picture column. To update it using JSOM, try the below code: var clientContext = new SP.ClientContext(); var web = clientContext.get_web(); var lists = web.get_lists(); var oList = lists.getByTitle("TestList"); oListItem = oList.getItemById(1); var urlValue = new SP.FieldUrlValue(); ...


1

Solved with this solution. function addNavigationNodesChild() { var idOfParentNode = $('#selectChildParentNavNode').val(); var nameOfParentNode = $('#selectChildParentNavNode option:selected').text(); var titleOfNavNodeChild = document.getElementById('addNav1Child').value; var urlOfNavNodeChild = document.getElementById('addNav2Child').value;...


1

You can get user details by its id like following: function getUserById(userId) { var appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl')); hostweburl = decodeURIComponent(getQueryStringParameter('SPHostUrl')); var context = new SP.ClientContext(appweburl); var appContextSite = new SP.AppContextSite(context, hostweburl + ...


1

First of all, sp.js IS loaded when you execute your code, otherwise you will get a "undefined" error message when calling "SP.ClientContext.get_current()". So, SP.SOD works as expected and loads the sp.js asyncronous. I investigated a bit, I think I found the place, where your error occurs. It seems to occcur in the function SP.ObjectPath in the "sp....


1

Oh my god. /_layouts/sp.js was not included in the Javascript includes. Apparently, this loads by default in the Preview for Nintex. HOWEVER! SP.SOD.executeFunc('sp.js', 'SP.ClientContext', beginJSOM); Is worthless. because it still executes beginJSOM function regardless. I think this post will be useful since I never saw anyone successfully get JSOM ...


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