Tag Info

New answers tagged

0

Try this: var currentuseremail; ExecuteOrDelayUntilScriptLoaded(init,'sp.js'); function init(){ this.clientContext = new SP.ClientContext.get_current(); this.oWeb = clientContext.get_web(); this.currentUser = this.oWeb.get_currentUser(); this.clientContext.load(currentUser); ...


0

Try this SP.SOD.executeFunc('sp.js', 'SP.ClientContext',function(){ var context = new SP.ClientContext.get_current(); var web = context.get_web(); var currentUser = web.get_currentUser(); context.load(currentUser); context.executeQueryAsync( function(){ alert(currentUser.get_email()); }, function(sender, args){ ...


0

You don't get authentication prompt on IE because IE is automatically signing you in to SharePoint using the credentials you've used when logging into Windows. Internet Explorer can be configured to prompt for credentials when connecting to servers requiring authentication. For example, IE can prompt you for a user name and password when you connect to ...


0

jQuery deferred object can solve your problem. https://learn.jquery.com/code-organization/deferreds/examples/ Using the above concept you can make the asynchronous calls work in synchronous way. Let me know if you have more questions.


0

I believe the easier option is to use External Content Type (Which points to SQL table) and use it to create External List. In this case you don't need to develop anything. After creating External List you can customize the forms.


0

Add ContentTypeId to your select. In an on premise SP 2013 environment I found this is an important key. To return the ContentType Name, it is not enough to expand the content type. You also have to include ContentTypeId in the select. In other words, this will not achieve the desired result: ?$select=Id,ContentType/Name&$expand=ContentType However, ...


0

The "proper" way to do this is with Business Connectivity Services (BCS). BCS can be a bit heavy handed if your needs are for a periodic one way sync of a single list. Does it have to be real-time? The path of least resistance would be a scheduled SSIS package leveraging the SharePoint List Connector available here: ...


0

This script seems to be what I need too, but get errors aswell. Modified it to incorporate the suggested errors as well as to suit my need $(document).ready(function retrieveListItems() { JSRequest.EnsureSetup(); var school_id = JSRequest.QueryString["School_id"]; var camlQuery = new SP.CamlQuery(); var clientContext = ...


0

Web.SiteUsers usually contains all users, that do have explicit permissions somewhere in the Web. Are you sure that there is no Point where permission inheritance is broken up and the users were granted explicit permissions? Finally, you can´t be sure that the users you get have the permissions you want to check. You can only check permissions, which the ...


2

If all these pages are on the same site you could look at using the sites property bag. Read in Property Bag values var ctx = new SP.ClientContext.get_current(); var site = ctx.get_site(); var web = site.get_rootWeb(); var webProp = web.get_allProperties(); ctx.load(web); ctx.load(this.props); ctx.executeQueryAsync(); To set the property ...


3

You can access the Site's Property Bag using the JavaScript Client Object Model. Here's a walkthrough: http://www.jeremythake.com/2013/10/using-the-sharepoint-csom-api-to-get-a-property-bag-value/


2

A few options: Write the value to a list on the site (it may only have a couple of columns and a single row if it's just storing one value) and read that. Create a single frame in the window and use JavaScript to navigate through the pages. You can either read from this frame's JavaScript or by tacking a query string onto the links on the page and reading ...


1

Unfortunately the absolute URL isn't the best, but it's something :) You'll better need to have the site relative URL for the file, which you can pass then to GetFileByServerRelativeUrl available in Web object, using the correct Web where the file is. This method is available also in CSOM and REST API, so you can build and issue the REST query directly from ...


1

Using JavaScript you can get ID using var list; ExecuteOrDelayUntilScriptLoaded(Start, "sp.js"); function Start() { var currentcontext = new SP.ClientContext.get_current(); list = currentcontext.get_web().get_lists().getByTitle('ListTitle'); currentcontext.load(list, 'Id'); currentcontext.executeQueryAsync(Function.createDelegate(this, ...


1

You can also fix in this way. SP.SOD.executeFunc('sp.ui.rte.js', null, function () { if (/var \$v_0 = RTE\.Selection\.getSelectionRange\(\);[\r\n\t ]*var \$v_1 = \$v_0\.parentElement\(\);/.test(RTE.Canvas.checkCurrentFocus.toString())) { var _oldCheckCurrentFocus = RTE.Canvas.checkCurrentFocus; RTE.Canvas.checkCurrentFocus = function () ...


1

I think that depends a lot on how your project is structured and your deployment process. In scenarios like this, I use feature activation code to provision my document library with a GUID generated by the Visual Studio tool. Then in my code I reference this GUID where necessary. Then once the feature is packaged, deployed, and activated, it is consistent ...


3

You can, however it'll require adding code to the parent page and utilizing window.postMessage(). You will have to add an event listener on the parent page to listen for the message, and then open the dialog: window.addEventListener("message", receiveMessage, false); var receiveMessage = function(event) { if (event.origin !== "your app") return; ...


0

You have to roll your own logic in that case, the default Save action saves and closes the form. So if you want some sort of tabbed interface that allows the user to "save" then finally "submit" you need to create functions that do the following: the Save button would create a list item if you are on tab 1 otherwise it is an update to the list item, Submit ...


1

Promises to the rescue! (SharePoint front-end developers -meaning, anyone writing code with JSOM- should really start to familiarize with the concept of Promises). If you wrap your async function in a promise, you can have your loop producing a new promise, push it to an array of promises, then wait for all of them to complete and lastly, run your alert. ...


2

By using the hints Anders provided and the reference here. I can make it work with below script. Simply put it into a Script Editor Webpart for the page you need it. <script language="javascript" type="text/javascript"> function DoSomethingWithRibbon() { // Gets a reference to a CUI.Ribbon object (CUI.js) var ribbon = ...


0

Of course there can be differences in the API (since there are mor than 6 years technological Progress).


-1

why don´t you use some variables (a set of booleans or a int with bit flags)? Each function sets ist own value to true (or another value indicating "done"). and starts a verification function. The latter one checks if all are set to true ("done") and if so, it does the alert. This way you could do this async


0

Thank you, Ransher. Now it works by using your tip: function GetCurrentDisplayedMonth() { var date = new Date($('#myCalendar').fullCalendar('getDate')); var month_int = date.getMonth(); return month_int; } --Added code block


1

You could do it with javascript I guess, the name of View is Ribbon.Read, so this should work: SelectRibbonTab('Ribbon.Read', true);


0

If you are using SharePoint 2010, SharePoint does special formatting to content editor web-parts. You have two options Use an HTML Form Webpart. SharePoint will not modify the contents of this webpart and it will work like a content editor webpart working in SharePoint 2007 and prior. Use a .txt file which you store your content in and link to it with ...


1

I'm not sure why in getPages method you are getting sub sites (SP.Web.getSubwebsForCurrentUser method), but the following example shows how to retrieve list items from Pages library: SPQueryHandler.prototype.getPages = function(){ var that = this; var web = that.clientContext.get_web(); var list = web.get_lists().getByTitle('Pages'); var ...


1

From what I have read here, Delve doesn't use any master page. You cannot make script injection in Delve...


0

It turns out, I just have to add the attributes in CSS as below. <style type="text/css"> .myFrame1 { position: relative; overflow: auto; } .myFrame1 li { list-style: none; height:250px; width:375px} .myFrame1 ul li { float: left; } .myFrame1 ul {margin-left: -40px;} </style> This will do the trick. Hope this can help ...


0

[EDIT: I see you want a coded solution, mine below is for OOTB with SPD but may help you? Not sure] This is typically done via calendar overlay, where a view exists for each type you want to color code differently. But this requires two lists, one is the "list where the data is" the other is the calendar. I am accomplishing this task by using a workflow to ...


1

Consolidate into one file. Advantages are big, and disadvantages don't really exist, as you have full control of the functions/variables (sure, you can make mistakes, but you can do that otherwise as well), and browsers cache the JS file, but remember to enable BlobCache.


1

Instead of separate file you can also use CSR/JSLink here. That way you can consolidate all the function for each of the form in one JavaScript file. You simply need to use JSLink option for those pages(Newform.aspx, DispForm.aspx and Editform.aspx). Here is the examples for JSLink(CSR): Client-side rendering (JS Link) code samples Using JSLink to ...


1

Hi i have just put up a fiddle for you,updated fiddle hope that helps SCRIPT $('#mycalendar').fullCalendar( { header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, dayClick: function( date, allDay, ...


2

There is no way you'll ever get access to the users password. (In fact SharePoint don't know it, as Authentication is handles by other components. In fact even these hopefully don't know it, but only have some hash of it). To access anything in the host web you can use the cross-domain library. Login will be handlede automatically. See How to: Access ...


1

My starting point is to have one shared instance of SP.ClientContext. I'm going to augment the object instance so using new keyword is preferable: var ctx = new SP.ClientContext(); The basic theory is to create a method execThen returning a promise, called when executeQueryAsync finishes, but only once for each "listener". Something like this: Usage ...


2

If you're running a SharePoint hosted app you can't just create a context for a different site and request data that way, it will run into same-origin issues. Luckily, the SharePoint App model has a couple of tools to solve this in the form of the cross-domain library (for using the REST API) or using an AppContextSite object (for the JSOM). Here is an ...


0

You are attempting to use a property that has not been loaded yet. Line 9 contains user.get_loginName(). Before you can use this, you need to load it first: clientContext.load(user, 'Include(LoginName)'); clientContext.executeQueryAsync(function(){ oUser.removeByLoginName(user.get_loginName()); clientContext.executeQueryAsync( ...


1

You should may be use new ZacTestModal() instead of new ClearanceModal() in your javascript ko.applyBindings


0

Just had to confront myself with the same problem (seems to occur only with filter webparts lol). I solved it by overriding the $3r_1 and making sure that the css class 's4-wpcell' is NOT being removed from the webpart. This works fine for me (even with 2 listview webparts it allows multiselection and the ribbon behaves correctly and it deselects items ...


2

Query should be like below <OrderBy> <FieldRef Name="Modified" Ascending="FALSE"></FieldRef> </OrderBy> <Where> <Eq> <FieldRef Name="Author"/> <Value Type="User">Display Name</Value> </Eq> </Where> Make sure you are using Display Name and not Domain User Name ...


0

Added in 1st function: this.myParam = "Hello SharePoint World"; then available in called function


-1

You need to make 2 changes 1. Change the definition of onQuerySucceeded function to contain your variable oList. 2. Change the way you call this success function. Refer below the updated code. function lockMandaysItems(tID,oList) { var clientContext = new SP.ClientContext.get_current(); var oList = ...


2

function CheckMemberInAdminGroup() { var clientContext = new SP.ClientContext.get_current(); this.currentUser = clientContext.get_web().get_currentUser(); clientContext.load(this.currentUser); this.userGroups = this.currentUser.get_groups(); clientContext.load(this.userGroups); clientContext.executeQueryAsync(success, failure); } ...


0

use variable this this.Page.ClientScript... Make sure u have referred JS file in the visual webpart.


1

I don't think you can (yet, perhaps in SP 2016), see Query SP2013 Managed metadata term store - Use JSOM. Since you use Angular I would suggest your wrap SP.ClientContext in a promise, this way you can use both JSOM and REST ($http) together fluently, like this: Setup: var ctx = SP.ClientContext.get_current(); ctx.exec = function() { return ...


0

So I did a little programming work-around that solves all of my problems. It may not be the "best" or the "right" way to do it, but it easily provides unique permissions on each form in one list without having to move the form around. $(document).ready(function() { //use this to get the current user thisUserAccount = ...


2

The following selector worked for me: $('td.ms-vb-user a:contains(NOTAPPROVED)').closest('tr').css('background-color', '#f5a9a9'); User fields do not get the ms-vb2 class applied to them (at least not in my views in O365).


0

jQuery's :contains is case sensitive. If the value in the column is NOTAPPROVED then you need to do this: $Text = $("td.ms-cellstyle.ms-vb2:contains('NOTAPPROVED')");


0

open dialog box to create wiki page function openDialogAndReceiveData() { var options = { url: "MycreateWikiPage.aspx", dialogReturnValueCallback: onClose }; SP.UI.ModalDialog.showModalDialog(options); } function onClose(result, returnValue) { if(result== SP.UI.DialogResult.OK) { ...


0

You can use the property defaultView: "month". This will display the calendar in Month View. Take a look at http://joshmccarty.com/2011/11/sharepoint-jquery-and-fullcalendar%E2%80%94now-with-spservices/ For changing month, first you need to calculate the start. Then you can use that value in camlQuery and camlOptions.


0

JSOM or JavaScript Object Model is a coding practice in which we use JavaScript API reference for SharePoint 2013. Refer this link to get an idea REST or Representational State Transfer is introduced in SP2013 that is comparable to the existing SharePoint client object models. Refer this msdn link to get more idea and also this MSDN Magazine To get the ...



Top 50 recent answers are included