Questions tagged [jsom]

Use the JSOM to retrieve, update, and manage data in SharePoint.

Filter by
Sorted by
Tagged with
6
votes
3answers
5k 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: ...
1
vote
2answers
215 views

Looping jsom getItems

I want to make a function to get data from SP list thru jsom, when i run the function with multiple items I get the error, with only one item it does work correct. Error: Uncaught Error: The ...
0
votes
3answers
297 views

How to bind the REST API result

Today I got requirement to get the list data using rest and bind to html drop down . I am getting the information by filtering it from browser (_api/web/lists/GetByTitle('Tabletop%20Sessions')/items?...
3
votes
1answer
2k 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 ...
8
votes
1answer
2k views

'ctx' variable in SharePoint

Recently I came across the variable ctx (link) in SharePoint which allows you to get the name of current list/library without any fuss. Apparently the ctx variable has quite few more tricks up its ...
3
votes
2answers
3k views

How to color code the SharePoint list column value based on a condition?

I have a requirement to color code a SharePoint list column value based on a condition. Please see the below screenshot. Basically as shown in the above image, I want to compare the value of columns ...
2
votes
1answer
421 views

JSOM, Calendar Recurring task: “Item does not exist. It may have been deleted by another user.”

I create calendar recurring tasks with JSOM(SharePoint 2013 on-prem). It works, and I can open this item from "All Events"(not "Calendar") view. But if opened in "Calendar" view - it gives "item ...
1
vote
1answer
2k views

SharePoint 2013 JSOM Paging - The Prev Page Button gives error - Request Failed.Exception from HRESULT: 0x80131904 undefined

I am using SP 2013 JSOM for paging and sorting the list data in <table>. I have referred the code from this link https://code.msdn.microsoft.com/sharepoint/SharePoint-JSOM-list-5104ca92/...
1
vote
1answer
2k views

Get clicked item ID from list

I have a list with items. Each item contains a link to another page. If a user clicks on one of those items, the specific item should get updated with a date when he clicked it. Now I get a target ...
0
votes
2answers
608 views

How to get the List Item id when a sharepoint choice column changes?

One of the JSOM solutions I am working on, I am alerting the SharePoint choice column value upon change. I have a list called Asset List (collaboration list) with four columns: Title, Stage(Choice ...
19
votes
2answers
53k views

ExecuteOrDelayUntilScriptLoaded with sp.js when in debug mode Object Expected

I currently have a JavaScript file that gets loaded in my SharePoint pages. jQuery(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(myfunction(), "sp.js"); }); myfunction = function(){ ...
9
votes
4answers
7k views

Get Parent web of a subsite using JSOM in SharePoint 2013

How can we get an immediate parent web of a subsite using JSOM ?
7
votes
1answer
4k views

How to get the current list/library name using JSOM?

How to get the current list/library name using JSOM? So far I found two snippets which return GUID of the current list/library, but not the name. // Using standard JSOM SP.ListOperation.Selection....
4
votes
3answers
6k views

SP2013 javascript client object model - get server time

My client machine and server machine has time offset of 2:30 hours. So when I try to retrieve Date/Time field using JSOM, it gives time according to offset. oListItem.get_item("Modified"); So how to ...
1
vote
1answer
219 views

SP Online - Use promises in SharePoint-Hosted Add-in

I want to know what is the best way for using JS chaines promises in for SharePoint-Hosted Add-in. In my code: I have a pageLoad function that's getting data from SP and I want to execute pageLoad ...
1
vote
4answers
3k views

Zip document library using JSzip

How do I zip and download all the files (keeping the folder structure) from a document library using Jsom and jzip Library? Download multiple files then compress to one zip file using JSZip & ...
6
votes
3answers
3k views

Change sort order in returned ItemsCollection

I am fetching a collection of items from a list using a CAML query. The returned items are then populated in my custom HMTL table. There is, however, another HTML table for which I need the same ...
4
votes
1answer
671 views

How to add Previous/Next buttons to SharePoint blogs posts?

How to add Previous/Next buttons to SharePoint blogs posts so I can navigate to previous or next post ?
3
votes
4answers
19k views

Get User object from Person or Group field value using JSOM/JavaScript API

How do you get a User object from Person or Group field value using JSOM/JavaScript API? I am looking for something like this (See Vadim Gremyachev answer), but let me be clear I DO NOT WANT the ...
2
votes
1answer
10k views

SP Online - Get items from list(CAML) with JSOM

I want to get list item with caml query for SharePoint Hosted Add'in. Query will returned one item.. This is my code: function getUserData() { var employeeList = clientContext.get_site()....
2
votes
2answers
2k views

Is it possible to create a Link to a Document with REST or JSOM?

Is it possible to create a SharePoint list item that uses the Link to Document content type? I would like to be able to add new links with REST, but JSOM could work too. I was thinking if I could just ...
2
votes
2answers
1k views

Open modal dialog from webpart in the parent page

I have written a SharePoint application which is embedded in a page as an AppPart. Now I want to open a modal dialog in the parent page. This code opens the dialog only in the current AppPart: ...
2
votes
0answers
753 views

Managed Metadata Global Navigation

I’m using managed metadata to create global navigation on a SharePoint Master Page. I understand that a managed metadata term set can only be applied to a single site collection. To bypass this I’m ...
0
votes
2answers
1k views

How do I like an item on a discussion board via REST or JSOM

I have a discussion board with posts on it. Discussion Board 1 post1 post2 post3 I want to "like" the item in post2 in "Discussion Board 1". How would I do this via REST or JSOM. I have looked ...
3
votes
3answers
3k views

Displaying All sites a User Has access to, Across an Entire Web Application!

I have had this issue for a while, and been asking piece-meal questions for a few weeks. I finally created a full solution that worked. And wanted to provide the full solution, that was both EFFICIENT ...
3
votes
1answer
888 views

Find friendly url from term guid using javascript

We have a cross-site publishing setup with a managed navigation from terms that the items are marked with. On the item pages I have the term or terms that a given item is marked with. I have both ...
3
votes
1answer
73 views

Updated the selected view in list view webpart

Good morning, I have awired issue to reflect the changes in list view to list view webpart in web part page programmatically using JSOM What exactly I need to change the selected view in list view ...
3
votes
3answers
3k views

Create/Update Task List item “ParentID” column via REST issue

I'm trying to create a list item in a default SharePoint Tasks list, with a specific parent id to create a hierarchy of tasks, e.g. Parent Task --> Child Task --> etc. The internal property "...
3
votes
1answer
537 views

send the task to approval center using JSOM Project Online

I have found many scripts on the internet on how to update a task using JSOM, but through JSOM i am able to only checkout, checkin and publish. The task doesnt go to approval center. Is there a way to ...
2
votes
1answer
290 views

Custom Time value is not getting saved in SharePoint calendar list using javascript

here am trying to create/save event in custom SharePoint calendar list using JavaScript,here event is getting created at my entered date but issue with time value means it is not saving my entered ...
2
votes
1answer
1k views

How to use JSOM/CSOM in SharePoint 2010 to get information about the current user like department, title, manager and phone number

I've seen how to get information about the current user using CSOM/JSOM from Get current user in Client Object Model with javascript? but I can't figure out how to get other properties like: ...
2
votes
1answer
1k views

JSOM How to get User Id

When trying to resolve a user with the ensureUser() call, the object is always returned as undefined even though the user exists as a Domain and SharePoint user. //Calling code. var currentCtx = SP....
2
votes
1answer
249 views

Populate people picker during PreSaveAction

I'm in a SharePoint 2013 on-prem farm. I have a people picker field called Managers that I want to populate based on users in another people picker field. Once the user clicks Save on the New Form, it ...
2
votes
0answers
432 views

Correct usage of getListItemChangesSinceToken() in JavaScript

I'm working on a Sharepoint hosted App, that accesses List Data from the Hostweb as I outlined here: EventListener for List changes in Sharepoint Hosted app I want to use the ...
2
votes
2answers
421 views

Add default value to the site column inside content type using javascript Sharepoint 2013

I am creating some site columns using javascript. And also I am creating content types. I am attaching these site columns to the content type with the <FiedRef> tag. But I want different default ...
2
votes
2answers
1k views

Custom PreSave with SharePoint validation first

I'm working on a list new form where the user is going to create both a list item and a taxonomy term with custom properties. I'm using JSOM to create the taxonomy term with custom properties and I ...
1
vote
1answer
441 views

Html Table Row button click event is not working

I am trying to fetch the row data on html button click. Below is my code. Here thr problem is when i click on the send email button page is getting refreshed. Also the click event is not getting fired....
1
vote
2answers
2k views

GetUserEffectivePermissions returning 0 (“EmptyMask”)

I'm trying to retrieve the current user's permissions for a list but I keep getting an emptyMask result, even when my current user account is a Site Collection Admin. function ...
1
vote
1answer
69 views

How to get item ids when using JSOM (when not it in content.executeQueryAsync)

is it possible to get item ids when not using executeQueryAsync. See my code below. I would like to get the item ids as i'm doing below in successGetListItemId() but would like to store in an array ...
1
vote
1answer
466 views

how to use JSOM to modify permissions for multiple list retrieved by a CAML query

Using SharePoint 2010 JSOM I know how to get a list item by it's ID, break its inheritance, then add a user to it's permission list with contribute access. What I cannot figure out is if I get ...
1
vote
2answers
111 views

running async calls in sequence

Hi I believe I need to execute the following code in sequence otherwise if lists get long I may get errors because one async call may affect the other. I have two cascaded async calls. I have only ran ...
1
vote
2answers
123 views

JSOM to load pop with new item form if user is not created previously

I want to create one SP dialogue box at home page which load the new item form of list or survey if current login user is not created any item previously. Is there any way to do that ? I tried using ...
1
vote
2answers
234 views

JSOM Error: unable to get property 'apply'

I get an error after attempting to update an item SharePoint 2013. This one is a bit of a challenge since it's referencing a different file. var siteUrl = _spPageContextInfo.webAbsoluteUrl var ...
1
vote
1answer
27 views

Change Content Type of Multiple files using JSOM

I have a Document Library with classic Experience with a lot of file who's content type I want to change automatically in bulk Due to the fact that I dont have access to PowerShell I was wondering is ...
1
vote
2answers
766 views

JSOM Error in SharePoint Client Code When Retrieving User Object

Trying to figure out why I am getting this error with my code, am I missing a script reference, or is perhaps something wrong with the Context data grab section? Error: The property or field 'Email' ...
1
vote
1answer
357 views

Include Synonyms/Other Labels for terms from store JSOM

SharePoint 2013 on-prem. I'm trying to work with terms and the termstore using JSOM. I found this tutorial which uses SP.Taxonomy.js and LabelMatchInformation to retrieve terms which match a given ...
1
vote
1answer
101 views

how can I get the xml format for my list view web part

I need to add a list view web part in web part page using JSOM, I don't know how can I generate the XML for list view, not the content editor var siteUrl = '/sites/MySiteCollection'; var ...
1
vote
0answers
394 views

JSOM enumerator get_item(“TaxonomyField”) return differently in no-markup Sharepoint-hosted addin Page

We are running the same simple web.get_lists().getById("id") script in two distinct markup pages. It works fine in both pages, except when it comes to a Managed Metadata Taxonomy Field: enumerator....
1
vote
2answers
65 views

SP Online, can I add my ViewField value to SP.View.viewFields with JSOM?

I need to add dissappeared ViewField to my List view (Calendar). it was before, but was dropped after I switched default view to another, and then returned back (I swutched my view back to 'Default ...
1
vote
2answers
2k views

How to update List item with Managed Metadata column using REST or JSOM

How can i update List item with Managed Metadata column using REST or JSOM? Any good sample or suggestion will be appriciated....