Skip to content

Instantly share code, notes, and snippets.

View fabianneve's full-sized avatar

Fabian Neve fabianneve

View GitHub Profile
@fabianneve
fabianneve / RedirectOrReturnSnippet.html
Created November 12, 2018 14:23
Forward user to a Thank You Page, but return to previous page when cancelling the survey - https://fneve.blogspot.com/2017/04/sharepoint-survey-forward-user-to-thank.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>
# 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.
@fabianneve
fabianneve / TerminateSpWorkflows.ps1
Last active October 31, 2018 08:11
There are many options to kill workflows in SharePoint which are built on SharePoint 2010 platform. It is a bit more difficult to terminate those on 2013 platform. Here is a script that terminates all workflows based on their status. It is also possible to filter for specific items with a CAML query and it iterates trough large lists in batch si…
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
<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>
$(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);
"use strict";
(function($){
$.fn.tocMenu = function(options)
{
// Helpder Methodes
String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
};
// 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) {
.tocMain {
border-bottom: 1px #333 dashed;
}
.tocMain a:active {
}
.tocMain a:hover {
}
.tocMain a:visited {
color: #0072c6;
}
<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() {
<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>