Instantly share code, notes, and snippets.

View RedirectOrReturnSnippet.html
<script src="/sitecollection/site/SiteAssets/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('input[value=Cancel]').click(function() {history.go(-1);});
});
</script>
View getSpRecycleBinContent.ps1
# recycle bin's are tied to a site collection so we need a site collection object
$site = get-spsite https://webapplication/sitecollection
#we can see everything in the recycle bin like this:
$site.Recyclebin
#unfortunately, the above command dumps quite a lot to the screen.
#fortunately, we can pipe the output to other commands for filtering and cleanup.
View TerminateSpWorkflows.ps1
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
$webURL = "https://webapplication/sitecollection/site" #change this to the url of the site
$listName = "Listname" #change this to the corresponding list
$web = Get-SPWeb $webURL
$count = 0
$countTarget = 0
$spQuery = New-Object Microsoft.SharePoint.SPQuery
View sp.tableOfContentsReferences.html
<link href="/SiteAssets/TableOfContents/sp.tableOfContents.css" type="text/css" rel="stylesheet">
<script src="/SiteAssets/TableOfContents/jquery.min.js" type="text/javascript"></script>
<script src="/SiteAssets/TableOfContents/sp.tableOfContentsSticky.js" type="text/javascript"></script>
<script src="/SiteAssets/TableOfContents/sp.tableOfContents.js" type="text/javascript"></script>
<script src="/SiteAssets/TableOfContents/TableOfContents.conf.js" type="text/javascript"></script>
View TableOfContents.conf.js
$(document).ready(function() {
// Change this options to your need
var options = {
orderedlist: false,
customStyle : "no-bullets",
prepend : true
};
// Initialize table of contents for the rich text editor
$(".ms-rtestate-field").tocMenu(options);
View sp.tableOfContents.js
"use strict";
(function($){
$.fn.tocMenu = function(options)
{
// Helpder Methodes
String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
};
View sp.tableOfContentsSticky.js
// Author: Fabian Neve / http://fneve.blogspot.ch/
// Date: 18.09.2017
// With input from https://blog.sharepointexperience.com/2014/10/sticky-stuff-in-sharepoint/
//
// Top alignment of ToC has to be defined in sp.tableOfContents.css under #s4-workspace.scroll .right-wp-zone-col
var wrap = $("#s4-workspace");
wrap.on("scroll", function(e) {
View sp.tableOfContents.css
.tocMain {
border-bottom: 1px #333 dashed;
}
.tocMain a:active {
}
.tocMain a:hover {
}
.tocMain a:visited {
color: #0072c6;
}
View TableOfContent.html
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
function hideTOC() {
document.getElementById("theTOC").style.display = 'none';
document.getElementById("show").style.display = 'block';
document.getElementById("hide").style.display = 'none';
}
function showTOC() {
View SP_SkipUpdateFormAfterImageUpload_sample.js
<script type="text/javascript">
window.onload = function() {
if (!PreSaveItem()) return false;if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')) return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl39$g_31aae83b_4f8e_4609_a4ee_d5f9cde46fe4$ctl00$ctl02$ctl00$toolBarTbl$RightRptControls$ctl00$ctl00$diidIOSaveItem", "", true, "", "", false, true))
}
</script>