Skip to main content

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
19 votes
2 answers
28k views

SharePoint 2013 REST - Create list item with user field and lookup field

I'm trying to add an SPListItem to an SPList via REST, but have a problem with User or Group and Lookup (information already on this site). function adddullitem() { var item = { "...
Chetvergov's user avatar
17 votes
4 answers
20k views

Get the current UI language with ECMAScript

Is it possible to get the display language from within ECMAScript? Similar to Get the current UI language from a webpart, I'd like to get the user's display language, however I want to access it with ...
Modery's user avatar
  • 547
17 votes
2 answers
3k views

Cannot add custom web part to page using the JS OM

I'm trying to add a custom web part (that is one I have written myself) using the new Javascipt OM available with SharePoint 2010. My solution is also running within the Sandbox. I have it working ...
Daniel McPherson's user avatar
16 votes
1 answer
5k views

Change Sharepoint language with a link?

Is there a way to get the language-switch control as static link in the pagelayout? I want my users to switch between German and English with a single click. Sorry guys, found a solution :D <...
fr34kyn01535's user avatar
14 votes
2 answers
28k views

When to use scriptlink, scriptblock and script

I have seen an application page where the developer using scriptlink, and below that just , I was wondering when would each one be used?
SharePoint Freak's user avatar
14 votes
2 answers
11k views

(Solved) Start a Workflow of the Host-Web via SharePoint App and JSOM

The Last Update is the Solution I have got an App for SharePoint 2013, which needs to start a Workflow. This Workflow is in the HostWebContext, not in the AppContext. The List, the Workflow is ...
13 votes
4 answers
11k views

Can't upload a non-text file to SharePoint App via REST API

I am using the following REST code to add a file as an attachment to a SharePoint 2013 list item. <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> <SharePoint:ScriptLink ...
Fedor Shihantsov's user avatar
13 votes
2 answers
11k views

Wait for _spPageContextInfo to initialize

What is the fastest way to wait/check for _spPageContextInfo to be initialized? I use AdditionalPageHead so my scripts are loaded before _spPageContextInfo is set. Here are some alternatives, some I ...
eirikb's user avatar
  • 7,415
12 votes
3 answers
91k views

SP.ClientContext.get_current() returning undefined objects

I am trying to get some information about the current context through the sharepoint javascript object model and am getting annoying errors. $(document).ready(function () { ...
user avatar
12 votes
4 answers
26k views

SharePoint REST API call with more than 500 rows

I have an AJAX call querying the SharePoint REST API which will return more than 500 rows: $.ajax( { url: _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='...
tnw's user avatar
  • 517
11 votes
2 answers
55k views

the property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested

The below question was based on this article: http://www.learningsharepoint.com/2011/09/10/get-all-folders-using-ecmascriptjavascript-client-object-model-sharepoint-2010/ I think the author there ...
Luis Valencia's user avatar
10 votes
5 answers
17k views

Query SP2013 Managed metadata term store

I was wondering if it is possible to query the Term Store via the REST API or Javascript Client Object Model in SP2013. I can't quite seem to work out the naming scheme for the REST API to discover ...
Lukie's user avatar
  • 263
9 votes
3 answers
37k views

ExecuteOrDelayUntillScriptLoaded(codetorun,SP.js) for entire script function

If you look at below code, I have used executeordelayuntillscriptloaded at start of my script so that it will run only after that file is loaded. But this breaks some functionality. Can you check this ...
variable's user avatar
  • 4,471
8 votes
3 answers
14k views

How to find the current folder through JS COM?

Is there a way to get a reference to the current folder through the JS COM? It doesn't seem as though it can be done with SP.ListOperation. And by current folder, I mean the folder the user is ...
Dylan Cristy's user avatar
  • 12.7k
7 votes
4 answers
17k views

Javascript to display sharepoint list items on page load

With Client Object Model API and a bit of javascript, I want to retrieve the items of a sharepoint list and display them into the web page, when the web page loads. I've successfully implemented ...
Emiliano Poggi's user avatar
7 votes
3 answers
21k views

Cannot get field value of list item through JavaScript

I try to get the value of a list item (that is currently selected). I know that I must load it into the context but even with loading the field explicitly I get the following message. Microsoft ...
Shihan's user avatar
  • 599
7 votes
4 answers
24k views

Get Current Login User Profile Properties SharePoint

I need to get current login User profile properties provide information about SharePoint users, such as display name, email, PictureUrl and other business and personal information including custom ...
Melad Batta's user avatar
  • 1,011
6 votes
1 answer
15k views

SPFx calls blocked by CORS policy

I'v been trying to access various apis through SPFx and I am constantly seeing this issue. I do not know how to fix this can anyone assist or explain what I am doing wrong or missing? This works ...
Batman's user avatar
  • 1,478
6 votes
2 answers
2k views

Can we unlock a ShortTerm lock via CSOM for SP2013

We are using SP2013 with OWA installed. Users often complain about a file stored in SharePiont being locked by another user not in office. Error is "The file "xxxx" is locked for exclusive use by ...
Mark L's user avatar
  • 4,065
6 votes
3 answers
4k views

What exactly is the webPermMasks property?

I'm trying to understand what exactly is the "webPermMasks" property inside the "_spPageContextInfo" object, I tried to look in many websites on the web and also in the MSDN. In the MSDN I wasn't ...
FabioEnne's user avatar
  • 201
6 votes
3 answers
6k views

How to retrieve distinct values with JavaScript Client Object Model

How can you get distinct values from a SharePoint List column using JavaScript without a huge performance hit? A simple example would be appreciated :)
Anders Aune's user avatar
  • 6,268
6 votes
2 answers
8k views

Rest Query Managed Metadata Filter

I am currently writing a JSON query for office 365 (sharepoint 2013) where the filter is suppose to filter depending on values returned from a managed metadata field I am trying to filter based on ...
Miyagi's user avatar
  • 623
5 votes
3 answers
9k views

Javascript to get GUID from SharePoint

I am newbie to SharePoint and I am uploading a file to the server using javascript. Now the task is to get the GUID of that file and display it ({alert(guid); is fine). I don't even know where to ...
Thisisme..'s user avatar
5 votes
1 answer
10k views

Javascript : How to handle version conflict errors when using javascript COM?

so I use quite a bit of the javascript client object model for CRUD operations to lists from custom pages (inputs) and I have found that I get version conflict errors on saves from time to time....its ...
Justin's user avatar
  • 1,361
5 votes
3 answers
24k views

How to access list in SharePoint Hosted App?

I want to create an Sharepoint hosted app but how to access list in these App ??
Rajesh Joshi's user avatar
  • 1,344
5 votes
1 answer
4k views

Can we access list from other site collection sites using javascript object model?

ECMAScript object model can only be used in SharePoint sites. So you can’t use this object model in an asp.net site to access SharePoint resources deployed in another url as this is cross-site ...
variable's user avatar
  • 4,471
5 votes
2 answers
7k views

Run javascript after display template loaded

How can I run some JavaScript after my display template has loaded. I have tried: AddPostRenderCallback(ctx, function () { jQuery(document).ready(function () { alert(jQuery('.ms-srch-...
Dillydallydave's user avatar
5 votes
1 answer
22k views

Calling the SP.UI.ModalDialog.showModalDialog method

My SharePoint solution has a userControl that Register a js block string getJS(string title, string htmlContent) { return (string.Format(@" ExecuteOrDelayUntilScriptLoaded(function (...
Rami Alshareef's user avatar
5 votes
4 answers
18k views

How to get list by url using client object model?

Is it possible to get list by url using ECMA script client model? For example something like this: context.get_web().get_lists().getByUrl("Lists/MyList"); UPD!: Please, refer to this correct ...
Sergei Sergeev's user avatar
5 votes
2 answers
4k views

Sharepoint 2010 ModalDialog title

I am creating a popup window in sharepoint using this code in javascript. function openDialog(title, url, width, height, CallResult) { var options = { url: getUrl(url), title: title, ...
user avatar
5 votes
3 answers
6k views

Run JavaScript after "group by" in list has been clicked on and list data loaded

I have created a JavaScript function to take a url from a list item and turn it into an image. This function works great on a list that doesn't have group by setup. With this script the images will ...
Neil Hoff's user avatar
  • 541
5 votes
1 answer
1k views

upper/lower case naming convention for Document name in SPO Doc Lib

I have a situation where users have uploaded several files but without any naming convention. So some of the file names are in upper case while some are in lower case . So Now I have to build a script ...
mdevm's user avatar
  • 1,255
4 votes
1 answer
24k views

How to get all fields of a list using JS Client Object Model

Is it possible to retrieve all fields of a list (or default view) through the JavaScript Client Object Model and filter the fields on type (e.g. I only want the Choice fields). var clientContext =...
Bart's user avatar
  • 1,027
4 votes
2 answers
4k views

Enable like function from catalog page via javascript object model - improve this?

The business need is to create a 'channel' page that will display thumbs of videos like a gallery, and I need to enable people to 'like' that content from the gallery page. (Standard disclaimer: I'm ...
Kevin Lowe's user avatar
4 votes
2 answers
14k views

Error on sp.js property 'isNullOrUndefined'?

When I try to run my javascript SP.JS file in a user control I get this error: Microsoft JScript runtime error: Unable to get value of the property 'isNullOrUndefined': object is null or undefined ...
Christoffel de Gruyter's user avatar
4 votes
3 answers
5k views

Add multiple people using Javascript Client Object Model to a Field of Type SPFieldUserValue

I want to update a UserField client side. I found the following code at this topic How to Use ECMA CSOM to Set a Field of Type SPFieldUserValue Tried the following code: var users = new Array(); ...
i_borgos's user avatar
4 votes
3 answers
15k views

Get a list Id using javascript?

I'm trying to trigger the NewForm.aspx of a list by clicking on a link. I would like to known how to get a list ID using JavaScript (Or jQuery)? (SP2010) I've already tried : var context = new SP....
ameliapond's user avatar
4 votes
1 answer
4k views

get_fieldValuesAsText usage example

I need to get items using JSOM and show them on a page in a display form. So currency field will be shown like $ 123,456.78 the date will be formatted accordingly to settings and Yes\No value will be ...
Serhiy's user avatar
  • 379
4 votes
3 answers
9k views

Copy file using javascript client object model - new version

I have a solution that adds a custom button to the ribbon in SharePoint 2010 and am using the javascript client object model behind the scenes to copy a file from Library A to Library B when the ...
Richard Dillon's user avatar
4 votes
1 answer
3k views

SharePoint RTE: How to attach to mousedown events (like bold, italic does)

When clicking on bold text in the RTE (rich text editor), magically the ribbon button for bold gets activated, as you can see here. The same happens for the other format option buttons you can see ...
Dennis G's user avatar
  • 4,775
4 votes
1 answer
5k views

how to find out when a user last visited?

I'm trying to figure out when a user has last visited.So let's say I logged out of my SharePoint intranet last night at 11PM, and this morning I logged back in at 9AM, I'd like to see a message saying ...
Magali's user avatar
  • 1,511
4 votes
3 answers
8k views

how to read all recurrance events from sp calendar list in SP hosted app

I am trying to create one SP hosted app which will read all events (includes recurring) from SharePoint calendar list. I tried but am enable to reach to it. my code is as below. function ...
sharepoint2013's user avatar
3 votes
2 answers
14k views

How can I pass a Parameter via Query String to populate a lookup field on a New Item Form/DVWP?

I have two lists: List A: Products List B: Requirements I'd like to have a nice Create Requirement page launched from the Product Listing page. I have a DVWP/Multi-Item View displaying all Products....
Cory M's user avatar
  • 354
3 votes
4 answers
12k views

TypeError: SP.ClientContext is undefined

I tried to add data to a list using a HTML Form and Javascript. When I sent the data to the list I got TypeError: SP.ClientContext is undefined. After I cleared the cache and cookies everything ...
bloomingsmilez's user avatar
3 votes
1 answer
9k views

How to trigger the click event of the SharePoint OOTB list's new form Save button?

I have custom list in which there are two mandatory fields, and I want to ask the user if he wants to again enter the new item after one item is created. I searched over the internet and found this ...
users1100's user avatar
  • 3,230
3 votes
0 answers
307 views

Another "load required sharepoint files" issue

I know there are many posts on the subject of dynamically loading SP files. I've tried so many of them, but none of them seem to work. As I was trying to solve an issue I realized I had to back up and ...
Rothrock's user avatar
  • 3,010
3 votes
3 answers
5k views

Uncaught TypeError: undefined is not a function

I access my web in javascript code in SharePoint 2013. I'm using Jquery and KnockOutJS for my other functions. So I have added following urls above my code. <script type="text/javascript" src="...
Sivakumar Piratheeban's user avatar
3 votes
1 answer
1k views

how to create new event in SharePoint calendar list with JavaScript?

i want to create new event in SharePoint calendar list in which I have some custom columns,i tried below code but it is not working function bookingRoomForMeeting() { var ctx = new SP....
Madhav's user avatar
  • 1,494
3 votes
2 answers
15k views

How to retrieve a ListItem using the Javascript Client Object Model?

Right now I am using this method: function getWebProperties(id) { var ctx = new SP.ClientContext.get_current(); this.website = ctx.get_web(); this.listCollection = website.get_lists(); ...
Abe Miessler's user avatar
  • 6,755
3 votes
1 answer
2k views

js link group count list SharePoint 2013

(function () { var itemCtx = {}; itemCtx.Templates = {}; itemCtx.Templates.Group = GroupOverride; SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx); })(); function ...
TSSS22's user avatar
  • 65

1 2
3
4 5
13