Tag Info

New answers tagged

0

This is because of the post-back events, one of the validation seems to be failed on your page before the event happens, i recommend to identify it and try fixing it.


0

Try it, its working : var clientContext; $(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', execOperation); }); function execOperation() { try { clientContext = new SP.ClientContext.get_current(); } catch (err) { alert(err); } }


2

I don't think there's a general approach to do this, but depending on your exact needs there might be a solution. I can think of a few options: Create a list to hold the HTML nodes and apply audience targeting to the individual list items. This way, the user could execute a clientside request to the list to pull back all nodes but they'd only receive nodes ...


0

Due to async nature of JSOM I would recommend this approach. The example demonstrates how to create multiple list items using JSOM: //Create multiple contact items using Named Function Expressions (http://stackoverflow.com/a/7065175/1375553) var createContactItems = function createContactItem(i,itemsCount) { ...


0

I used include all the requires javascripts as per the below sequence and there by I was able to include the SP.js. <script src="/_layouts/1033/init.js" type="text/javascript"></script> <script src="/_layouts/MicrosoftAjax.js" type="text/javascript"></script> <script src="/_layouts/sp.core.js" ...


-1

I said this before in another question: Add javascript to sharepoint 2013 you can reference scripts in the masterpage of this forma: <SharePoint:ScriptLink language="javascript" name="custom.js" OnDemand="true" runat="server" Localizable="false" /> Referncing a java script inside my master page will not fire NOTE: you can use ...


1

Since you have jQuery loaded, perhaps you can use the $.getScript() function to load SP.js: var scriptbase = siteUrl + '/_layouts/15/'; $.getScript(scriptbase + 'SP.Runtime.js', function() { $.getScript(scriptbase + 'SP.js', retrieveListItems); } ); Info on $.getScript() here.


2

Try adding following references to the additional page head of the page <script type="text/javascript" src="_layouts/15/sp.runtime.js"></script> <script type="text/javascript" src="_layouts/15/sp.js"></script> Then try using following script jQuery(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', ...


2

Add a reference to "/_layouts/MicrosoftAjax.js" and you no longer get the Type is not defined error. I got the answer here.


3

It could be you're calling retrieveListItems before SP.js has been fully loaded, in which case try: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems);


-2

Try this:<script type="text/javascript" src="/_layouts/15/sp.js"></script> <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> IF you have codebehind file access of that aspx page then add these methods protected override void Render(System.Web.UI.HtmlTextWriter writer) { ...


0

A hyperlink column will let you create a hyperlink, but it will block your javascript injection for security reasons (and rightly so - otherwise anyone could write any amount of javascript and have it execute on the page). There are many ways to do what I think you are trying to do. I recommend using jQuery to rewrite your links after the page loads.


2

JavaScript will not work if you set pagination on the listview. Instead I will suggest to use a Calculated column. Assume, Column "SUID" has the value ";708089113=0184?" Create a calculated column and set the following formula... =RIGHT(LEFT(SUID,INT(FIND("=",SUID)-1)),LEN(LEFT(SUID,INT(FIND("=",SUID)-1)))-1) This will give you that value 708089113. ...


0

Looks like you're looking for MSOLayout_InDesignMode var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; if (inDesignMode == "1") { // page is in edit mode } else { // page is in browse mode } This will refer to value of the following html input control, which is rendering on the page when it is in edit mode: ...


0

This is really simple in jQuery if you have that available, make sure this in an AdditionalPageHead control <script type="text/javascript"> $(document).ready(function(){ $("input[Title='SUID']").change(function(){ var elm = this.val(); var val = elm.split("=")[1]; //do other stuff }); }); </script> jQuery is really usefuly in ...


0

Try to attach the handler on window.onload event. Place following javascript under AdditionalPageHead <script type="text/javascript"> window.onload = function() { var elm = document.getElementById('ctl00_m_g_0842343c_4653_49c3_b9ec_28682a09dff0_ff01_ctl00_ctl00_TextField'); elm.addEventListener('change', function (e) { var s = ...


1

We had the same problem in our environment couple of months of ago, when ever you try to update the solution it says successfully deployed but still no changes showed. Almost same steps we followed as you mentioned. Finally we use some tool to check which Dll load in the Timer services and here we found our problem. SO in our case easy fix was Restart ...


0

You can use below snippet to get the document set Check if a document set exists function getDocSet(listTitle,docSetName, success,error) { var context = SP.ClientContext.get_current(); var list = context.get_web().get_lists().getByTitle(listTitle); var items = list.getItems(createGetDocSetQuery(docSetName)); context.load(items); context.executeQueryAsync( ...


1

You can add custom action to the list callout according to this article. In a nutshell: function myCallback() { var link = window.location; // for current item you can probably get this from renderCtx, can't test right now var emailSubject = "email subject" // Here you can add article title, or just static string window.location = ...


1

Napa supports side-loading through the 'Run Project' button on the left hand menu which will directly load your project into your developer site collection. This is much faster than packaging your app for deployment and installing it on your SharePoint site, but you need to be using a developer site collection or a site with the developer features turned on. ...


0

Napa was created with the objective to facilitate a 'lightweight, in-browser experience' to build SharePoint or Office web app in the same browser where they would run. Ergo, it was designed to kind of complement the inherent features of the browser. For advanced tooling, one would have to turn to Visual Studio 2012. You can debug code like any ...


0

Well haven't ever used Napa, done only provider hosted apps but whenever I saw 403 error I needed this solution: $config = Get-SPSecurityTokenServiceConfig $config.AllowOAuthOverHttp = $true $config.Update() Maybe this is also a security problem on your farm.


0

The correct syntax is to use the function name without parenthesis. The statement SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems()); should be SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems);. Similarly ExecuteOrDelayUntilScriptLoaded(retrieveListItems(), "sp.js") should be ...


1

If you would have your own custom list definition, you could deploy a custom form for your list instance, and set the JSLink element of the Form. You cannot set it "globally" for the list, only per form. If your list instance is based on a built-in list instance (like Tasks in your case) you should set the JSLink property from code. If you would like to ...


1

Thanks for the help, unfortunately it didnt work for me since there where something wrong with my SP.Publishing reference. Instead I fixed it with this code: $(document).ready(function () { if (window.location.href.indexOf("_layouts") > -1) { $(".ms-breadcrumb-top").show() } else { $(".ms-breadcrumb-top").hide(); } } All ...


3

The folder isn't in SharePoint Designer (or more specifically, isn't inside the web/site collection) instead it is in 15 hive which is physically located here (and is shared with all the webs/site collections): C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15


0

For client side cascading drop downs, I use SPServices. If you aren't familiar with it here is a link to the SPCascadeDropdowns. For this you will have to have your cascading structure defined in lists with lookup fields. After you set that up it's fairly straight forward. Here's a couple more resources on how to use SPServices and cascading drop downs: ...


0

There is a workaround to get the (C#) CSOM to work in a farm solution (the name for solutions that encompass code that needs to be installed on the server), there is an SP StackExchange answer on that here: CSOM in FarmSolution You could also use a Sandbox solution as you mentioned; C# code in sandbox solutions is deprecated but you could create a webpart ...


0

Using the Set interval javascript function and calling your variables again you should be able to hind the time as required. After you have called your variable do a statement to check if it has been set previously so as to not wrap the div again. You set the variable v by assigning it again to the variable


0

With @Vince2322589 help, I found the solution to this by just using setInterval method and minor modification on my script.


0

I am having the same issue. Considering it has been two months since an update, I guess no one has found an answer.


0

Angular JS is one of the approach you can try. http://jsfiddle.net/7sm9r76o/6/


0

You initialized the variable as itemID var itemID = $("#ctl00_m_g_32d59762_da31_442a_8334_da53c330611c_FormControl0_V1_I1_S7_I1_H1").text(); But called it with itemId this.varitem = list.getItemById(itemId); It's easy to overlook! But Javascript is case-sensitive, so you'll need this.varitem = list.getItemById(itemID); As discussed in the comments ...


1

SharePoint is a content management platform. I comes with lot of features out of the box and using that you can create applications with no code at all. There will be situations you require to customize, in those cases you have following options Using SharePoint designer Using Visual Studio Following are different technologies you can use Server Side ...


2

Try this $(document).ready(function(){ $('#ctl00_m_g_de548742_27f6_4e71_b3ec_2d9a1ecca117_ff151_ctl00_DropDownChoice').on('change', function(){ var accountType = this.value; if(accountType == 'Military') { $('.milShow').show(); $('.ctrShow').hide(); $('.civShow').hide(); } ...


2

The following example demonstrates how to read Json file and parse it (the data from your JSFiddle has been saved into file): $.getJSON("/SiteAssets/Announcements.data", function(data) { var rowsData = data.NewDataSet.GetListItems.listitems['rs:data']['z:row']; var content = renderRows(rowsData); $('#listview').append(content); }); function ...


3

The error: The user does not exist or is not unique most probably occurs since user could not be found. The list of methods that could be utilized for removing a user from group: SP.UserCollection.remove SP.UserCollection.removeById SP.UserCollection.removeByLoginName The following examples demonstrate how to remove User from Group using ...


0

Using REST You can REST endpoints for removing users from groups http://msdn.microsoft.com/en-us/library/office/dn531432(v=office.15).aspx#bk_UserCollectionRemoveByLoginName executor.executeAsync({ url: "<app web url>/_api/SP.AppContextSite(@target)/web/sitegroups(7)/users ...


1

You've got a plenty of answer how to check permissions. If you want to check the group membership (it is of course not the same as permissions), then you have to check which groups the current user is member of and decide where to redirect. Alternative 1 I have written a little example how to achieve this using jsom. Suppose you have a group called ...


0

If you want to get the list of available choices programatically (as opposed to the actual value of a particular list item) you can do something like this: (function() { var myCtx = SP.ClientContext.get_current(), myList = myCtx.get_web().get_lists().getByTitle("myList"), myField = myList.get_fields().getByInternalNameOrTitle("myField"), ...


0

Thank you for this post. To start workflows 2010 you can use InteropService. var interopService = wfServiceManager.getWorkflowInteropService(); interopService.startWorkflow(workflowName, null, null, null, initiationParameters); Worked example here.


3

In this approach it is determined whether User belongs to specific Group and if so, then he/she is getting redirected to another page: function isUserMemberOfGroup(userId, groupId, success,error) { var ctx = SP.ClientContext.get_current(); var allGroups = ctx.get_web().get_siteGroups(); var group = allGroups.getById(groupId); ...


3

I'm assuming you're on a standard SharePoint page -- if so, you can use the _spPageContextInfo object's userId and userLoginName properties. They come along for the ride when the page is rendered. From my browser dev tools: >_spPageContextInfo.userId 1337 >_spPageContextInfo.userLoginName "somebody@somecompany.onmicrosoft.com" If you're dealing ...


0

function retrieveListItems(siteUrl) { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('choiceOpt'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml( '<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' + '<Value ...


0

You definitely need an app web, because you need to use SP.RequestExecutor.js to make the cross domain calls using javascript -- this depends on having an app web to perform the cross site communication. Something else worth noting is that the terminology used sometimes can be confusing on the webs... HostWeb: your main SharePoint portal site, where you ...


0

None of these other answers above worked for me, and I don't know how they would. Here is my brute force method of how I got it to work: // Default the Requestor's Name var welcomeText = $('[id*="zz8_Menu"]').text(); // this is zz7_Menu in SP 2007 var user = welcomeText.split('Welcome ')[1]; var counter=0; $('div[title="People Picker"]').each(function() { ...


3

After trying out different options available online, I was able to achieve it by JavaScript <!--SPM:<SharePoint:ScriptLink ID="ConfigurationScriptLink" Name="~sitecollection/SiteAssets/js/Configurations.js" runat="server"/>--> CSS <!--SPM:<SharePoint:CssRegistration ID="CSSCustom" Name="&lt;% ...


0

You should also handle the child a tag as follows $('.ms-cal-topday').each(function(){ $(this).removeAttr('onclick'); $(this).removeAttr('onmouseover'); $(this).removeAttr('onmouseout'); }); $('.ms-cal-topdayover').each(function(){ $(this).removeAttr('onclick'); ...


0

As far as I know the JavaScript CSOM does NOT support expanding recurring events (the same is true for REST / OData) as described here. I suggest you to use the GetListItems method of the Lists web service directly or indirectly via SPServices (see sample and discussion) if you need calendar related functionality on the web UI. Instead of iterating through ...


1

SPWeb has RootFolder which internally has WelcomePage property. You can use that to get this information var clientContext = new SP.ClientContext.get_current(); var spWeb = clientContext.get_web(); var rootFolder = spWeb.get_rootFolder(); clientContext.load(rootFolder, 'WelcomePage'); clientContext.executeQueryAsync(Function.createDelegate(this, ...



Top 50 recent answers are included