Skip to content

Instantly share code, notes, and snippets.

@sksnips
sksnips / PnP.createweb.cs
Created May 16, 2016 10:30
This code snippet used to create a website using PnP Core Component - CSOM Extensions
//Author: Shantha Kumar T
// Assembly Reference Used: OfficeDevPnP.Core, Version=2.4.1605.0, Culture=neutral, PublicKeyToken=3751622786b357c2
//Supports: SharePoint Online, SharePoint 2013+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
@sksnips
sksnips / disablePageCustomizationAccess.js
Created March 31, 2016 05:12
This JSOM code snippet removes the owners/members permissions to customize the pages in advanced mode in the current Site Collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowRevertFromTemplate (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function disablePageCustomizationAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to disables the page customization access
oSite.set_allowRevertFromTemplate(flase);
@sksnips
sksnips / enablePageCustomizationAccess.js
Last active March 31, 2016 05:10
This JSOM code snippet enables the owners/members to customize the pages in advanced mode in the current Site Collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowRevertFromTemplate (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function enablePageCustomizationAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enables the page customization access
oSite.set_allowRevertFromTemplate(true);
@sksnips
sksnips / getPageCustomizationAccess.js
Created March 31, 2016 05:05
This JSOM code snippet identifies whether customizing the page in advanced mode is allowed on the current site collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowRevertFromTemplate (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function getPageCustomizationAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
@sksnips
sksnips / disableMasterPageAccess.js
Created March 28, 2016 04:06
This JSOM code snippet disables the access to users on customizing the master pages and page layouts in the current site collection level in SharePoint
//Author: Shantha Kumar T
//Property used: SP.Site.allowMasterPageEditing (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function disableMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to disable the master page access
oSite.set_allowMasterPageEditing(flase);
@sksnips
sksnips / enableMasterPageAccess.js
Last active March 28, 2016 04:04
This JSOM code snippet enables the access to users to customize the master pages and page layouts in the current site collection level.
//Author: Shantha Kumar T
//Property used: SP.Site.allowMasterPageEditing (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function enableMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enables the master page access
oSite.set_allowMasterPageEditing(true);
@sksnips
sksnips / getMasterPageAccess.js
Created March 28, 2016 03:57
This JSOM code snippet retrieves the value of master page customization is allowed on the current site collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowMasterPageEditing (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function getMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
@sksnips
sksnips / disableSiteDesignerAccess.js
Created March 3, 2016 06:01
Code snippet helps to disable the SharePoint Designer Access to the Site Collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowDesigner (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function disableSiteDesignerAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to disable the designer access
oSite.set_allowDesigner(false);
@sksnips
sksnips / enableSiteDesignerAccess.js
Last active March 3, 2016 05:59
Code snippets helps to enable the SharePoint Designer Access to the Site Collection
//Author: Shantha Kumar T
//Property used: SP.Site.allowDesigner (sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function enableSiteDesignerAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enable the designer access
oSite.set_allowDesigner(true);
@sksnips
sksnips / updatelistTitle.js
Last active March 2, 2016 04:53
Code snippet to update the title and description for the SharePoint List
//Author: Shantha Kumar T
//set_title() and get_description() properties used to set the title and description to the list respectively
//get_title() and get_description() properties used to get the title and description to the list respectively
//Property used: SP.List.title and SP.List.description(sp.js)
//Supports SharePoint 2010 + and SharePoint Online
function UpdatelistTitle(listTitle) {
var clientContext = new SP.ClientContext();
oList = clientContext.get_web().get_lists().getByTitle(listTitle);
oList.set_title('New List Title');