JavaScript Object Model

learn more… | top users | synonyms

0
votes
1answer
29 views

Identify if a Library item is a folder or not in CSOM

I have Library on which I have created a ribbon button. On click of the button I am trying to identify if the selected item is a folder or a file. below if the code snippet that I am using: var ...
1
vote
2answers
68 views

How to retrieve all items from a list by javascript object model and store it to array

I'm new to JavaScript Object Model in SharePoint 2010 and want to get some idea of that. I wrote below code to get all list items of a SharePoint library. This works fine and return all items. But I ...
2
votes
0answers
46 views

Using JSOM or REST get list items stored in a different web application

In an on-premises SharePoint 2013 environment I need to read list items stored in a different web application using JavaScript based solution. This could either be JavaScript in Script Editor web part ...
0
votes
0answers
9 views

Error starting a workflow on host web from within a SharePoint-hosted app

I am trying to start a workflow on the host web from within a web part in an app. Here is my code: var clientContext = new SP.ClientContext.get_current(); var hostWebUrl = hostUrl; var ...
0
votes
1answer
13 views

ReferenceError: SPClientTemplates is not defined

I am trying to use the client-side People Picker and I can't get it to initialize the people picker due to SPClientTemplates not being defined. I am following MS documentation line by line but cannot ...
0
votes
1answer
17 views

What governs the decision to use server object model or client object model or javascript object model or REST?

What governs the decision to use (in SharePoint 2013)?: server object model (ssom) client object model (csom) JavaScript object model (jsom) REST
0
votes
0answers
7 views

Querying 'Append Changed to Existing Text' from client script?

Is there a way, preferably via REST but JSOM would work, to query a SharePoint 2010 field to get all entries when 'Append Changes to Existing Text' on a multiple lines of text field is enabled?
1
vote
1answer
49 views

Read DOCX files using javascript in sharepoint 2013

Can we fetch contents of DOCX files uploaded in a doc library from javascript code ? I could easily read a TXT file ref : http://msdn.microsoft.com/en-us/library/office/jj163201(v=office.15).aspx . ...
0
votes
2answers
63 views

Invoking SP.ModalDialog in Sharepoint 2013 Hosted Apps

I'm building a SharePoint 2013, SharePoint Hosted app project using the JSOM api. I have to make use of the SP.UI.ModalDialog to popup some content in the app. I have used the getScript method to ...
1
vote
3answers
84 views

SharePoint 2013 getting all webs in a given site collection including root web using JSOM

Using JSOM I am trying to get the collection of all the webs(sub-sites) including the root web of a given site collection and display there title. Below is the code snippet. But it throws error ...
0
votes
1answer
62 views

get properties from an List Item

I'm following a code sample from msdn to get properties of items from a list. My announcements list has 2 items. But for some reason I get an exception while getting the enumerator (TypeError: ...
2
votes
2answers
61 views

SharePoint 2013 reading data from multiple document libraries from multiple subsites in one site collection

I have multiple subsites in single site collection. All of these subsites have document library with same name. So is it possible using JSOM to read data from multiple document libraries with same ...
1
vote
2answers
87 views

Updating list items by JSOM

I am currently trying to migrate a list from one sharepoint to another. I did this a few months ago allready and there it worked not bad. But now I run into problems. The list is a discussion list. I ...
0
votes
2answers
50 views

SharePoint Hosted App Code behaves different

This code is working if i dont use it in a app. But in a app its not working. The app is sharepoint hosted, and the list is on the same domain as the app. context = new ...
0
votes
1answer
30 views

Using results of executeQueryAsync with JSGRID

I understand I can retrieve the list data using context.load(data) and later firing context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, ...
0
votes
2answers
50 views

Insert record with Date into list via JSOM, problem with UK Format

I have found that when inserting a record which contains a Date using JSOM the update(); will not work if you specify the format of the date to be UK date (28/05/2014). The code does not error, it ...
1
vote
1answer
50 views

Upload file using JS and REST. Specify content type

I can upload file to SharePoint library using JS and REST. The content type of added file is as library default content type. How can i specify file content type when uploading file? Thanks!
0
votes
2answers
105 views

SharePoint hosted APP - Create subsite with JSOM under hostweb - Access is denied

I'm trying to create a SharePoint hosted app that creates a subsite under the hostweb with JSOM. The app has full control on the site collection. Why do i I getting this error message: My code: ...
0
votes
2answers
40 views

Get the ID of a new listItem and update same record

I'm trying to add a new record and get the new ID created then use the new ID to create a specific reference number using the following code. function saveDraftGHrecord() { ghList = ...
0
votes
2answers
194 views

Get/retreive managed metadata column value from Document Library using SharePoint 2013 JSOM

I am trying to retrieve managed metadata column (NewsCategory) value in SharePoint 2013 Document library using JSOM. I get "Object Object" rather than actual value. I tried:- var newsCat = ...
2
votes
2answers
166 views

Get list id from open view page via JavaScript

I have included some javascript in SharePoint master page, I need this javascript to have access to the opened list ID. For example when I load ...
0
votes
3answers
55 views

Check if the home page is checked out by the current user

Using JSOM, I would like to check if the home page is checked out, and if the current user is the one who checked-out the page. The test occurs from another page. Here is what I have now: var ...
0
votes
1answer
33 views

Csom code works if alert is implemented

This code works if i have a alert before , when i remove it, the isUserInList always shows false. Maybe i need to have a return value in CheckIfUserIsInList(); function ? var isUserInList = ...
0
votes
0answers
30 views

Access Items in DocumentSet using JSOM

I'm attempting to access items in a DocumentSet using SharePoint 13's JSOM. I am able to access the generic list properties but I do not see how to access ContentType specific properties on the client ...
1
vote
1answer
103 views

SharePoint Online, javascript get user properties

I'm trying to get some user properties and alert them (I'm going to put them i labels later but just for now I'm using alert). I'm using a content editor with this code: ...
1
vote
1answer
21 views

Get the SUM of Items from Media library in all site collections in SP2010 using JavaScript

How to get the SUM of Item Count from "Media" library in all site collections(more than 100) in SP2010 using JavaScript(or any other way). I've more than 100 site collections and each site collection ...
1
vote
1answer
73 views

SharePoint JavaScript Object Model Security and Permissions

I am writing an application whose logic executes in the browser using JSOM. The application might have permissions that exceed that of those who access the application. Let's say the application ...
4
votes
1answer
233 views

App prison break

Me an my colleges were discussing the possibility of breaking out of the sandbox that a SharePoint-hosted apps provide. As most of you know host webs in SharePoint 2013 are protected by deploying apps ...
1
vote
1answer
33 views

What is difference between executefunc and executeordelayuntilscriptloaded?

Execute func: SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { console.log("Initiating SP.ClientContext") }); ExecuteOrDelayUntilScriptLoaded: ...
1
vote
1answer
79 views

Reindex search results (Content Search Web Part, 2013)

I will just leave this here, since it helped us a lot: We have a Content Search Web part with custom Display Templates with link to edit item. After user edit item, we want to refresh the search ...
1
vote
2answers
342 views

Add List Item with managed metadata field through JSOM

I have a simple scenario, where I've a list with some custom content types. Among other fields, i have a managed metadata field. I want to add a new item in the list through JSOM and this is where I ...
0
votes
0answers
37 views

Set Web Part connection via client side code

Is there a way to set up a Web Part connection using client side code? I am open to any client side solution: SOAP services, JSOM, REST, other...
0
votes
3answers
185 views

executeQueryAsync in for loop

Lets say i have a function that has a for loop in it. I need to loop it becouse i have an array that i need to get items dynamically from: newsArray[i].Group. In the function Success , i will be ...
0
votes
1answer
88 views

Retrieve People or Group Field to string instead of Object

Iam retrieving an item from my list with jsom in a script editor. i retrieve a field wich is the type of: user or group field. I want to display the group name i retrieve. I tryied to parse to json, ...
2
votes
1answer
152 views

Get file ID after upload using JSOM

I use JSOM to upload document in library. I use this JS: var file; var fileCreateInfo; function CreateFile() { // Ensure the HTML5 FileReader API is supported if (window.FileReader) { ...
1
vote
2answers
71 views

how can we get the current url via JSOM on masterpage?

We have masterpage which is set programatically to all sites on all site collections. On masterpage we want to redirect user based on a value to a page in layouts folder. I have read that the ...
0
votes
1answer
515 views

How to Get User Active Directory Groups in Sharepoint Online

I can't find any documentation or a way to find if a user belongs to an AD group with Javascript neither with the REST API or with the client model JSOM. I have a page in a Sharepoint site and I want ...
1
vote
1answer
49 views

SharePoint 2013 navigation permissions

I have setup a metadata navigation. But now i only want sites to be visible for users that are members on this sites. Security triming does not works with metadata navigation, i was thinking some ...
0
votes
1answer
79 views

collection has not been initialized after dialog modal closes

I have two JS scripts on my SharePoint 2010 page, one in the master page, one in a forms web part (I've attempted this with a CEWP as well). Both are in unique name spaces (My.Tabs and ...
1
vote
0answers
46 views

Jsom not working when user is reader

I am using following code to get terms from a termset in MMS. It is a office 365 solution and some of users is external users which have read permissions. The javascript doesn't work when user is ...
2
votes
3answers
178 views

CSOM Change Field Name

I am trying to change the list column name. Here is my code, it isn't working. I added a content editor web part with this code: <script type="text/javascript"> //js ref </script> ...
0
votes
1answer
133 views

getTermSetsByName does not return an instance of TermSet

Following code does not work correctly var clientContext = new SP.ClientContext.get_current(); var tSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext); var ts = ...
1
vote
2answers
110 views

Error while accessing the User profile properties via JS code

Code gives error 2 times out of 10 attempts to refresh the page. We get error as: Request failed, unexpected responce from server. The status code of response is '0'. The status text of ...
0
votes
1answer
76 views

JSOM function get_isSiteAdmin() is always false

I'm trying to get the property "IsSiteAdmin" from a user object in Javascript JSOM. The app I am programming needs to be able to distinguish normal users from Administrators. function ...
4
votes
1answer
194 views

setting page layout using JSOM

I want to change page layout for some of my publishing pages using a SharePoint-Hosted app. Is there a way to changing (setting) page layout to a publishing page using JavaScript?
3
votes
1answer
257 views

Get quick launch using CSOM (JavaScript)

On my publishing site I have changed its current navigation (quick launch) to use structural navigation, showing all items under current site. I see that the quick launch shows pages and sub sites for ...
0
votes
1answer
54 views

getting sub terms from mms using JSOM and jquery deferred

I am trying to retrieve top navigation (terms and their sub terms) from MMS using JSOM and JQuery deferred. I need to have nested deferred because terms has sub terms. following is my code. ...
2
votes
1answer
246 views

Create Multiple List Items with One Function

Is it possible to create multiple list items with one function in JavaScript / ECMAScript? I know that a single item can be created with the code below, but would like to know if it is possible to ...
4
votes
2answers
2k views

Get a users Name from their ID

As part of my Sharepoint hosted App i am using a list which contains a Person or Group. I am getting the ID of the person by using the following. var ApproverID = ...
1
vote
3answers
352 views

There is no trusted URLs configured for the app deployment on Client side People Picker

I've built and been using a Sharepoint hosted app which uses a Client side people picker which all worked correctly until today. No when using them I get the following error. There is no trusted ...