FAQ Database Discussion Community


Call Javascript After Saving Calendar Item

javascript,sharepoint,csom
I am having a script as below:- function getColorValue(aId,atitle) { try{ var clientContext = new SP.ClientContext(); var oWebsite = clientContext.get_web(); var oList = oWebsite.get_lists().getByTitle('Item type'); var oListItem = oList.getItemById(parseInt(aId)); clientContext.load(oListItem); clientContext.executeQueryAsync(function () { var listItem = oListItem; var colorname = listItem.get_item('Color_x0020_Name'); if (typeof colorname != 'undefined') { if (colorname !=...

How to prevent fill in values when saving over CSOM to a choice field

c#,sharepoint,csom
I am writing some ETL code to move data between an external system and SharePoint Online. I am using the nuget package Microsoft.SharePointOnline.CSOM to communicate with SP in C#. I am using the following code to update my field values. spListItem[fieldName] = "Test Value"; spListItem.Update(); spClientContext.ExecuteQuery(); I noticed with Choice...

How to enableMajor?

list,sharepoint,csom
How could I enable Major versioning on "Pages" list? My code is not working and I don't get any errors. Any suggestions?.... _spBodyOnLoadFunctionNames.push(onPageLoad()); function onPageLoad() { ExecuteOrDelayUntilScriptLoaded(enableMajor, 'SP.js') } function enableMajor() { var ctx = new SP.ClientContext.get_current(); var list = ctx.get_web().get_lists().getByTitle('Pages'); ctx.load(list); ctx.executeQueryAsync( function () { list.enableMajor = true; },...

jQuery .css() not getting background position w/o !important in css

jquery,css,dom,csom
I am hoping someone could help me understand why the jQuery .css() (v1.11) method is returning 0% 0% for elements that have a non-overridden background position defined (in the inspector while running and in the style sheet). What I found a bit puzzling is why when I force an !important...

C# CSOM - Check if File Exists in Document Library

c#,sharepoint,office365,csom
I'm coding in C# using CSOM, my app uploads a template asp.net page to the "/Pages/" library, I need it to check if a file exists in that location with the same name prior to file upload (then maybe it can return a bool value). I did have a quick...

Add Button in SharePoint List Ribbon Button Using JSOM

javascript,sharepoint,ecmascript-5,csom
I have to add a button in Sharepoint List Ribbon button & in ECB Menu. here is the code to add ECB menu in Sharepoint List using JSOM. function AddCustomActions() { var listTitle = 'mylist Title'; var clientContext = new SP.ClientContext(); var oWebsite = clientContext.get_web(); var oList = oWebsite.get_lists().getByTitle(listTitle); var...

Checking if current user can view list in SharePoint CSOM

sharepoint,csom
How do I determine if the current user can view list items or read a list in SharePoint Online / Office365? I have some working code that returns the lists // Retrieve all lists from the server. context.Load(web.Lists, lists => lists.Include(list => list.Title, list => list.Id, list => list.Hidden, list...

SHAREPOINT 2013: How can I update a Site Column with the content of an array with javascript CSOM?

javascript,sharepoint-2013,csom,site-column
I'm relative new to Sharepoint 2013, I'm trying to update the content of a Site column with the content of an array, I can retrieve and visualize the content of my site column, the user is able to change and save the necessary part and the changes are saved into...

Creating term fails in SP 2013

c#,sharepoint,sharepoint-2013,csom
I am trying to create a term in a SP 2013 term set. I am able to read the terms from the term set with the given credentials. Settings: The ServiceAccountLogonName user is one of the Term Store Admins Code: var siteUrl = ConfigHelper.GetValue("SharepointSiteUrl"); var clientContext = new ClientContext(siteUrl); clientContext.Credentials...

SHAREPOINT 2013: How can I read Site column contents and modify them via javascript csom?

javascript,sharepoint-2013,csom
I'm relative new to Sharepoint 2013, I'm trying to access and display on a page the contents inside a specific "Site Column", I've have been reading a lot about this, but I still can't accomplish my task. So far I get to this: 'use strict'; var hostweburl; var appweburl; $(function...