JavaScript Object Model

learn more… | top users | synonyms

0
votes
0answers
5 views

SharePoint 2013: JavaScript Object Model - Create an enterprise wiki page

I have spent a couple of days trying to fix this problem. Goal: - Click a button on an existing page that creates an enterprise wiki page in the pages library and adopts the default custom layout. ...
0
votes
1answer
26 views

get list item by id using COM sharepoint 2013

I need to get item from list sharepoint by Id I use this code and it give me all the items of the list : <script> function parseURLParams(url) { var queryStart = url.indexOf("?") + 1, ...
1
vote
2answers
54 views

How to check whether item is being added or updated in PreSaveAction

I am using the PreSaveAction JavaScript function to handle list item add and edit operations. But depending upon whether the item is being added ( newform.aspx ) or being updated ( editform.aspx ) I ...
0
votes
0answers
29 views

Office365 REST API bad request while saving data to List

In a SharePoint hosted App am trying to save data to my list in Office 365 using REST API below is the code. The problem with this code is it works fine for less values passed (eg: my in my item I ...
0
votes
1answer
28 views

JSOM request limitations

I'm building a custom navigation for SP2013 that uses termstore to manage the menu items reasonably. This technet article covers basic termstore limitations, but it doesn't touch on the following ...
0
votes
1answer
35 views

JSOM function not getting called

I have two functions in my js file. Each function is used to fetch data from list. The first function is called as: jQuery(document).ready(function () { SP.SOD.executeFunc('sp.js', ...
0
votes
3answers
31 views

JSOM: Why web.lists.GetByTitle('myList') does not throw exception while web.Title throw exception

In JSOM, we can not access a property of an object before load and excecute. But I don't understand why code 1 works and code 2 doesn't: Code 1: Here I am accessing the List property of web var ...
3
votes
2answers
83 views

Reliably get attachments for list item

I'm working with SP2010's SP.js and I need to get all the attachments of a list item. As it's SP2010, I don't have access to SP.ListItem's attachmentFiles property. :( The following code works for ...
0
votes
1answer
30 views

Create docx file in document library using JSOM

I have written a script which creates a new txt file into the document library using Javascript. When I change the file extension to docx, it still creates but I'm unable to view the file.. It gives ...
1
vote
2answers
32 views

How to get web part id

This is a follow up question to the one i asked earlier : Reading web part properties using javascript object model In my earlier question I had been able to access the properties using jsom but i am ...
0
votes
2answers
26 views

How to handle list item events from client side using JSOM?

My requirement is like - When an item is added to a list, a log should be added to another list? And this needs be done using JSOM. is there a way to achieve this using JSOM?
2
votes
2answers
57 views

JSOM Anonymously CAML query list items

I am attempting to query a list using CAML via JSOM and am getting the error message The method "GetItems" of the type "List" with id "{GUID}" is blocked by the administrator on the server. I have set ...
2
votes
1answer
53 views

Reading web part properties using JavaScript Object Model in SharePoint 2013

I am using the below code to read the properties of a web-part using JSOM. While i can read the properties of the web-parts that are there on the current web part page, I would like to know of a way ...
0
votes
3answers
48 views

SP.ClientContext does't exist

I have SharePoint site, wherever I open developer tools and type: SP. I don't get the ClientContext as a suggestion, it's not loaded at all in SharePoint. I tried that on SharePoint application pages, ...
0
votes
1answer
20 views

Creating List based on List template with content

Now I could successfult create list based on list template but when i saved my list template i could say "Include Content" but when the list created by this code it was empty with no content any ...
0
votes
1answer
41 views

In SharePoint JSOM, how to get a column in the list by name?

The following code will get the list of all the fields in the SharePoint List, however what I m interest in is if a particular field exists or not. function ...
0
votes
1answer
15 views

Permission problem to get sub site info

i use this code to retrieve all sub sites under one sub site function GroupMenu(url,elem){ var sites = []; var clientContext =new SP.ClientContext(url); var webs = ...
0
votes
3answers
38 views

Get all sharepoint sites in a site collection to which user has access using Javascript client object model

I want to display all sites in a site collection using JSOM to which user has access to. In other words I only need to find collection of sites to which user has access in a site collection. I am able ...
0
votes
1answer
29 views

Error on ClientContext

When I try to get sub sites of specific sub site var clientContext = SP.ClientContext('/groupcompanies'); var webs = clientContext.get_web().get_webs(); I get this error: undefined is not a ...
0
votes
1answer
31 views

Get Latest Created List Item

I got array of objects that is list items arr = [{id:"1",name:"item1",created:"Wed Feb 04 2015 03:36:42 GMT+0400"},{id:"2",name:"item2",created:"Sat Feb 04 2015 02:44:39 GMT+0400"}] i want to get ...
0
votes
0answers
26 views

Setting Url Variable for Sub site

I'm trying to create news list system. I wanted to set Url Variable via Javascript and get the item back by id to display details. Everything went good but when I try to href ...
0
votes
0answers
32 views

Get Item from content type using Microsoft.SharePoint.Client.Search.Query.KeywordQuery(context) and display data in app part

How can I get a list item using Microsoft.SharePoint.Client.Search.Query.KeywordQuery(context) instead of a list query. I want to use the content type and not depend on the list to get the items.
0
votes
4answers
48 views

Retrieve data from taxonomyfield using jsom gives error

I have a managed metadata type column in my document library. I need to get the data from this column by using jsom. But whenever I try to get the values it gives me error. The code and error are ...
0
votes
1answer
31 views

JSOM code not executing correctly when run without debugging

I have a custom js that creates dynamic layout. There is a function which renders this layout consisting of multiple divs. When I debug the JS, the layout is rendered correctly but when I run it ...
0
votes
1answer
42 views

How to create a search using sharepoint JSOM

I'm new to SharePoint and JSOM and i'm trying to build up a search using JSOM. and i tried below code snippets I FOLLOWED FOLLOWING BLOG ...
3
votes
1answer
74 views

Most efficient way to get all sub sites under a site collection/sub site using JSOM?

For the question lets assume the following site hierarchy Root Site Sub Site 01 Sub Site 0101 Sub Site 0102 Sub Site 010201 Sub Site 02 Sub Site 03 Sub Site 0301 Now if I want to get all ...
1
vote
1answer
19 views

How to create site custom field

How can i create custom fields for a site or sub site like Title and Description i've sub sites and every site has unique banner and some information i want the user will be able to add these ...
0
votes
1answer
39 views

How to get all lists and document libraries in subsite

What I want to achieve now is to retrieve all document libraries and lists in sub sites with links to those libraries via JavaScript. So I can add them to my Page Layout to be like Side Nav
0
votes
1answer
17 views

How to get parent site lists

I am using JavaScript on a subsite to retrieve items from a list which is on the parent site. When I use this code: var clientContext = SP.ClientContext.get_current(); var lists = ...
0
votes
1answer
19 views

Retrieve list items Links

When retrieving list items via Javascript, how to get the link or action to click and go to that item link?
0
votes
1answer
37 views

Create a Sharepoint wiki page using JSOM

I need to create a Sharepoint wiki page using JSOM, Can anyone guide me to create path? I'm very very new to Sharepoint and eager to learn. I found this but it uses Rest API and didn't find it very ...
-3
votes
3answers
40 views

Unable to get property 'get current' of undefined or null reference

function listAllCategories() { var ctx = new SP.ClientContext(appWebUrl); var appCtxSite = new SP.AppContextSite(ctx, hostWebUrl); var web = appCtxSite.get_web(); //Get the Web var list = ...
0
votes
2answers
26 views

Real Columns names

var clientContext = SP.ClientContext.get_current(); var lists = clientContext.get_web().get_lists(); var oList = clientContext.get_web().get_lists().getByTitle(listName); var collListItem; var ...
0
votes
3answers
77 views

Java script how count users in group by javascript

How could I count how many users are in Group? How could I count by JavaScript.
2
votes
3answers
172 views

ExcuteQueryAsync functions inconvenient

Can any body explain this ? clientContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); it always output an Error in ...
3
votes
3answers
110 views
+50

Why does .get_title() called from an (SPOnline) App-Web return an incorrect Localized DisplayName?

!! this is NOT about localisation of the App Web Its about getting an incorrect response from the HostWeb when using get_title() !! Can someone please explain me where I go wrong with the testcode ...
0
votes
2answers
24 views

Retrieve all files from all folders

I've a picture Library which contains to folders i've retrieved them by this code getListItems('myList'); function getListItems(listName) { var clientContext = SP.ClientContext.get_current(); var ...
0
votes
0answers
30 views

_spFriendlyUrlPageContextInfo undefined despite using managed metadata navigation

I'm building a custom navigation solution using the JSOM in Sharepoint 2013. I need to get the navigation term corresponding to the current page and I found this question with a similar problem and ...
0
votes
1answer
27 views

Get publishing page url using CAML

I am retrieving pages using CAML, and doing for loop on the results like the following: function _onSucceed(){ var html=""; for(var i = 0; i <results.length; i++){ ...
0
votes
1answer
32 views

Cannot read property 'get_current' of undefined

I am using this code: "use strict" var BasicJSOM = window.BasicJSOM || {}; BasicJSOM.Crud = BasicJSOM.Crud || {}; $(function() { BasicJSOM.Crud.MainDemo = new BasicJSOM.Crud.Main(); ...
1
vote
2answers
54 views

JSOM List Item Field Values

This should be an easy one but for some reason the answer is escaping me. I am executing a query with joins that includes projected fields (fields from one of the joined lists) using JSOM. Using ...
0
votes
1answer
72 views

Cross SiteCollection call with JSOM not working

I got a problem and my brain says "yes you made no mistake" but it doesn't work. Here is my problem: I have a SharePoint hosted App which has "Tenant read" permissions in the App Manifest. That ...
0
votes
2answers
61 views

Is it possible to refer to a field hidden in current view from JSLink attached to current view?

I have the following JavaScript code attached to List's JSLink property: (function () { var coloringFieldContext = {}; coloringFieldContext.Templates = {}; ...
0
votes
0answers
58 views

List all workflows with WorkflowServices throws exception. GetWorkflowDeploymentService returns null

I try to list all site workflows. I followed several examples and try to get the workflows by using CSOM and JSOM. This always fails with the error message: Cannot invoke method or retrieve ...
2
votes
2answers
46 views

Is there any way to retrieve a Web by title using SharePoint 2013 JSOM without using the enumerator?

I need to get a subweb with a particular title using JSOM. So far, the only way I can see to do this would be to use code similar to the following: function getStuff() { var oWebsite = ...
1
vote
2answers
53 views

Reasonable way to get custom webpart properties via jsom?

I need to fetch some of the custom properties of my webpart from the front-end. Currently, I'm using var oFile = context.get_web().getFileByServerRelativeUrl(_spPageContextInfo.serverRequestPath); ...
0
votes
0answers
12 views

Property missing from cswp results

We are trying to do a custom control/item template layout to render results for cross-site publishing. We have made a proof of concept on a development test site that is working. When we try to ...
-1
votes
1answer
104 views

Calls to WebProxy without an app context are not allowed

From SharePoint 2013's default.aspx page (https://somecompany-public.sharepoint.com/pages/default.aspx) I'm trying to call a RESTful json API which lives outside the SharePoint domain, but getting ...
0
votes
1answer
132 views

How to include custom fields in clientContext.load()?

Loading some list items via var lists = web.get_lists(); var list = lists.getByTitle(listTitle); var listItems = []; for (var i in len) { listItems[i] = list.getItemById(itemIds[i]); ...
0
votes
1answer
38 views

Does JSOM offer an equivalent to SPQuery.CalendarDate?

I'm trying to get recurring items for a specific month from a list. Using the following, I can get the events for the current month: <Query> <Where> ...