Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [javascript]

Javascript is a dynamic computer programming language, most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.

Filter by
Sorted by
Tagged with
3 votes
2 answers
10k views

How can I include the same JS and CSS files on multiple SharePoint Modern Page?

I'm looking for a way to include JS and CSS files into a SharePoint Modern page, which can be done once across a number of pages. At the moment I've got the Script Editor web part to include my JS and ...
atomicharri's user avatar
19 votes
4 answers
18k views

Changing date format using javascript

I am getting date in 2015-10-30T05:00:00Z format from a SharePoint list using rest. Please help me to get the date in 2015-10-30 format using JavaScript.
KumarV's user avatar
  • 2,690
8 votes
1 answer
8k views

Differing ways to make executeQueryAsync calls - Function.createDelegate (is old IE8 code)

I want some understanding on two programming patterns I've seen and when to employ them. The question is about callbacks and delegate. In the first code there are two distinct functions, success ...
Orange Juice Jones's user avatar
18 votes
1 answer
7k views

What does this code getQueryStringParameter do?

I would like to know what this code does? I am using it almost all the time but I don't know what it does. function getQueryStringParameter(paramToRetrieve) { var params = document.URL.split("?")[1]....
abc's user avatar
  • 375
29 votes
5 answers
71k views

Check if user is in a specified group

I would like to check with JavaScript if the current logged user is in a specified and specific group (for example called "Admins Group"). How can I do? Thanks
Pepozzo's user avatar
  • 1,073
98 votes
13 answers
55k views

How do I know if the page is in Edit Mode from JavaScript?

Is there a way to find out if a page is in Edit Mode from JavaScript? I know server-side can be found using SPContext.Current.FormContext.FormMode but I can't find any means of doing it from ...
Renzo's user avatar
  • 2,097
40 votes
4 answers
69k views

SP.SOD how to use correctly?

SP.SOD is a nice feature of SharePoint, but how should I use it? For example, I use these lines of code ExecuteOrDelayUntilScriptLoaded(function () { //code }, "custom.js"); If I understand ...
Alexander's user avatar
  • 8,141
14 votes
7 answers
38k views

Enforce Drag and Drop documents to apply metadata

We have implemented an issue management system in SharePoint 2013 which provisions a page for every issue added to a specific list. One of the Web Parts the automatically provisioned page contains ...
boondawg's user avatar
  • 319
26 votes
6 answers
45k views

Send E-mail from javascript using REST API

I want to send email using Javascript/jQuery using REST API in SharePoint. I have tried _api/SP.Utilities.Utility.SendEmail and this is my code: Code $.ajax({ contentType: 'application/...
Kaushal Khamar's user avatar
4 votes
1 answer
9k views

Run JavaScript after page loads

I want to run some JavaScript (not jQuery) after the page loads in SharePoint. What method should I include in my script?
Martin Muldoon's user avatar
19 votes
4 answers
13k views

Grab a specific property bag using ECMA script

I am trying to grab a key/value pair from a specific property bag but can't find any documentation or example code on how to grab a property bag. Currently I can only seem to grab allProperties. Here ...
Meyer Denney's user avatar
  • 2,864
14 votes
9 answers
73k views

Getting a count of list items in a list via ECMAScript

I have a SharePoint 2010 web site with a master page that has a counter on it. I'm trying to update that counter using the ECMAScript. The code I have falls nicely into the success method - but I ...
grimorde's user avatar
  • 547
13 votes
6 answers
60k views

What is the proper way to add custom CSS/JavaScript SharePoint 2013 site?

I would like to tweak the default layout in SharePoint, e.g. add... .ms-number { white-space: nowrap; } ... to all pages. I know it is possible to modify a master page directly, but is it the ...
Egil Hansen's user avatar
8 votes
1 answer
24k views

How to authenticate user in SharePoint online using javascript

I have a public site on Office 365 SharePoint Online. By default when user clicks on to sign in, it redirect to Microsoft login page. I don't want to redirect user to Microsoft login page. But ...
Mihir's user avatar
  • 1,546
5 votes
7 answers
22k views

Set default value in people picker javascript/jquery

I want to set current logged in user to people picker by javascript. I can retrieve the value of user(lets say in var user).But how to set it to people control. Any help is much appreciated.
user avatar
36 votes
6 answers
167k views

REST API filter by start and end dates using 'today'

I'm new to filtering dates with REST in SP but am trying to do something like below but am not sure how to get today's date in as a variable into the request. I don't think I'm too far off so any help ...
Aaron's user avatar
  • 732
25 votes
5 answers
119k views

Get current user in Client Object Model with javascript?

var ctx = new SP.ClientContext.get_current(); var web = ctx.get_web(); ctx.load(web); var user = web.get_currentUser(); alert(user); I used above code to get the current user using JavaScript, but I ...
Nera's user avatar
  • 528
20 votes
6 answers
25k views

How do I trigger the default form validation without submitting the form

I'm customizing the NewForm of a list item and need to trigger the default form validation from my JavaScript, but I don't want the form to be submitted, since I'm doing that in a callback later on. ...
stinaq's user avatar
  • 1,080
7 votes
2 answers
29k views

Creating Folder using REST and JavaScript

I'm trying to create a Folder in a SharePoint Image library. I found an answer here but I can't seem to get it to work var web = 'my relative path to the current web'; var lib = 'name of the image ...
jasonscript's user avatar
4 votes
2 answers
13k views

SPservices to retrieve version history of items in SharePoint List 2007?

May I know how can one use SPServices to retrieve all the version history of a particular items in a SharePoint 2007 Server List? (If it is not possible via SPServices, are there other Javascript ...
Anderson Karu's user avatar
24 votes
3 answers
89k views

Adding new list item using REST

I am currently using Office 365 and lots of REST queries to display data. However I am now creating my own forms using Bootstrap and jQuery. However, how do I use REST to add the data to the list? ...
Miyagi's user avatar
  • 623
18 votes
3 answers
27k views

JavaScript: How to reuse the "Working on it..." pop in

Sharepoint 2013: In have custom JavaScript code that makes Ajax calls. While loading I'd like to show Sharepoint's loading pop in: That is the one that greys out the underlying page and centers a ...
Juergen Riemer's user avatar
18 votes
1 answer
8k views

Wait async query in PreSaveAction

Could you tell me, please, how can I wait for an async query to SharePoint list in PreSaveAction()? Is it possible? Thanks in advance!
Alexander Ulmaskulov's user avatar
16 votes
2 answers
32k views

How to get all properties of all users in SharePoint 2013 Rest API?

I am using this code to get all properties for just myself (current user). But how can I change this so that I can get the same data but for all the users in SharePoint? var oldurl = ...
omega's user avatar
  • 2,160
16 votes
5 answers
82k views

How to get current user with javascript?

I have a list . I want select items of list with a special quary.(get items that created with current user). Then get count of items. I use this code for get current user : function Initialize() { ...
ar.gorgin's user avatar
  • 1,238
11 votes
6 answers
98k views

How to get the login name of the current user using JavaScript?

I tried this code: var context = new SP.ClientContext.get_current(); this.website = context.get_web(); this.currentUser = website.get_currentUser(); alert(currentUser); But I got an ...
Nera's user avatar
  • 528
6 votes
3 answers
7k views

Query multiple lists using javascript/CSOM

I'm about to query multiple lists using JavaScript (JSOM, SharePoint 2010). It's working when querying one list in a time, but that's annoying when I'm having lots of lists. Working example: ...
kolback's user avatar
  • 279
6 votes
1 answer
51k views

SharePoint 2013 REST api to update list item- Uncaught ReferenceError: etag is not defined

I try to update my sharepoint list using REST api. But following code throws exception in browser "Uncaught ReferenceError: etag is not defined " Can someone help to resolve this issue? // update an ...
Sivakumar Piratheeban's user avatar
2 votes
3 answers
3k views

Help with Dual Javascript countdown clock

I am having a little trouble figuring out how to make this work properly, I am trying to put a small countdown clock in the left column and one in the right column, which will show a countdown to two ...
JeffA's user avatar
  • 33
2 votes
7 answers
34k views

Schedule a workflow to run everyday

I want a workflow to run each day at 2.00 AM. Is there a way to achieve this? I found many posts but didn't work.
Keerthi's user avatar
  • 1,113
1 vote
1 answer
1k views

Color Coding List Item by Web Part based on value

I am currently trying to get color coding on a list to highlight good medium and bad properties. I have tried to follow the examples shown here for color coding: SharePoint 2013 Client Side Rendering:...
Daniel's user avatar
  • 11
58 votes
7 answers
57k views

How do you get the current list item in JavaScript?

There's all kinds of ECMAScript class library examples around but all of the ones I find show how to retrieve all list items (through SP.ClientContent) but how do you get the current list item? I'm ...
Bil Simser's user avatar
  • 3,470
24 votes
11 answers
96k views

Get Site Collection full URL using javascript

I want to get the URL for my site collection. One way I thought I could do it was using the window.location in javascript and getting it that way. I know that you can use ECMA script and the client ...
John's user avatar
  • 3,763
22 votes
10 answers
29k views

How can I disable the Document Library drag and drop function?

Before I start - I'm new to this SharePoint development lark and am slowly familiarising myself with it. We're using SharePoint online and I have amended the SharePoint out-of-the-box document ...
TonyR's user avatar
  • 341
18 votes
2 answers
9k views

SP.Utilities.Utility.SendEmail with additional headers [javascript]

Want to use the built in SendEmail with javascript and jquery. Found this code and got it working -- sends the email -- using the code below: var appweburl = "https://example.com/site"; var ...
Rothrock's user avatar
  • 3,010
16 votes
4 answers
10k views

Basic batched GET requests using REST API

I'm hunting around on the web right now for some basic (preferably working) examples of making a batch of GET requests using the new $batch endpoint in O365 with the REST API. I've located some good ...
John-M's user avatar
  • 5,940
12 votes
3 answers
15k views

How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue

I have a JavaScript array containing the string representation of some usernames (domain\username format). Using the JavaScript CSOM, what is the best way to create a new item and add those usernames ...
Robert Kaucher's user avatar
12 votes
3 answers
8k views

Site Assets vs. Style Library

I usually store my JavaScript/jQuery files in the Site Assets library, but I see on forums that others are using the Style Library. What are the respective benefits of each?
Christophe's user avatar
  • 5,301
12 votes
3 answers
13k views

Add Ribbon Button via JavaScript

I have specific requirements from my client that he wants to add some additional Ribbon Button "but only" via JavaScript (including EnableScript reading value from some other list). They don't want to ...
Leo's user avatar
  • 121
11 votes
8 answers
22k views

SP.ClientContext is always "undefined" in JSLink functions

I'm trying to execute CSOM functions as part of a JSLink extension to override rendering of a Lookup Field. Problem is every time I try to access SP.ClientContext it returns as undefined I have ...
Martin Hatch's user avatar
  • 1,303
9 votes
1 answer
17k views

JSOM - get listitem by file URL

Task Short - Access item attribute from a picture library by picture url. Long - When editing a pagelayout and an image is added to the page, the image's description should be loaded. This is ...
Mx.'s user avatar
  • 3,333
8 votes
5 answers
28k views

Add Javascript to every page in Sharepoint 2013

I looked but from what I see most questions that have anything to do with this refer to an old version of Sharepoint where something is always different from what I see in SP2013. I basically just ...
Lorenzo's user avatar
  • 113
8 votes
4 answers
22k views

Combine REST query "GetItems" action with OData $filter parameter

I'm able to call GetItems through REST by using an example by Erik C. Jordan. Now I'm trying to combine this with a simple OData $filter parameter. I have a REST query like this (jQuery on SharePoint ...
eirikb's user avatar
  • 7,415
7 votes
4 answers
12k views

Javacript only executed on first page load

I have javascript code included in my sharepoint site. When I load the page the first time, it is executed, but when I load it the second time, it is not running. It get's loaded in correct order but ...
Peter's user avatar
  • 225
7 votes
1 answer
631 views

structure of sharepoint javascript functions

I am trying to understand more the structure of javascript functions in SharePoint. Why does every function begin with som value than colon and semicolon like ULSrE8:; in spgridview.debug.js: ...
Anatoly Mironov's user avatar
6 votes
2 answers
10k views

SharePoint 2013 Add Read more link in Announcement web part each list items

I want to add Read more link in my Announcement Web Part I followed this blog post: http://www.learningsharepoint.com/2013/04/07/styling-announcements-with-javascript-using-js-link-in-sharepoint-2013/ ...
MJ X's user avatar
  • 1,049
5 votes
3 answers
5k views

Remove item from ECB in sharepoint 2013

I am currently trying to write javascript within a script editor to hide the 'View Properties' and 'Edit Properties' items in the ECB. I have found many solutions that edit the core.js file. However, ...
Zoosmell's user avatar
  • 125
5 votes
2 answers
19k views

SharePoint 2013 Show/Hide Form Fields

I'm seeking help with an OOTB SharePoint 2013 list form. Disclaimer, I'm not a developer or programmer by any means, however I do understand how/where to apply code. And I can follow simple ...
Mr.Miller's user avatar
5 votes
3 answers
25k views

How to update multiple items in sharepoint list online using javascript

I want to update 4 items in the same time in my SharePoint custom list using JavaScript. I am using a CAML query to get the item witch I want to update. Can anybody please help me and write a function ...
Sinan Kachachi's user avatar
4 votes
1 answer
4k views

How to place "Description" field in List under the field name itself?

In my Office 365 (SharePoint Online) I have a very simple Custom List which has a few columns/fields, and I added some description to add clarity to users. The problem is that the description's text ...
Mary Larson's user avatar

1
2 3 4 5
13