Skip to content

Instantly share code, notes, and snippets.

import * as sprequest from 'sp-request';
let spr = sprequest.create({
username: 'xxx',
password: 'xxx',
domain: 'xxx'
});
spr.post('https://xxx/sites/test/_api/contextinfo', {
body: {
@MudassarAli
MudassarAli / PingUrlParallel.ps1
Created September 11, 2018 08:49 — forked from Buthrakaur/PingUrlParallel.ps1
Simple load test tool in powershell
workflow PingUrlParallel {
param(
[string]$url,
[int]$parallelCount = 10,
[int]$iterations = 10
)
foreach -parallel ($x in 1..$parallelCount) {
1..$iterations | %{
@MudassarAli
MudassarAli / Update-SPTokenLifetime.ps1
Created June 27, 2018 13:18 — forked from janikvonrotz/Update-SPTokenLifetime.ps1
PowerShell: Update SharePoint Token Lifetime #SharePoint #PowerShell
if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
# update SharePoint cache token lifetime
$SPContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$SPContentService.TokenTimeout = (New-TimeSpan -minutes 5)
$SPContentService.Update()
# udpate SharePoint claims token lifetime
@MudassarAli
MudassarAli / ForceUnlock.ps1
Created June 26, 2018 14:10 — forked from nlarkin/ForceUnlock.ps1
Powershell Script to force a undocheckout of a specified document using the bypasslocks method.
cls
$error.Clear()
##################################################################################################
# Load SharePoint Snapin
##################################################################################################
$snap = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snap -eq $null) {
Write-Host "Loading Powershell Snapin..." -ForegroundColor Yellow
Add-PSSnapin Microsoft.SharePoint.Powershell
< script type = "text/javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js" > < /script> < script type = "text/javascript" language = "javascript" >
$(document).ready(function()
{
$(document.getElementById('Ribbon.ListItem.Manage-LargeMedium-1-2')).addClass('ms-cui-row ms-cui-disabled');
ExecuteOrDelayUntilScriptLoaded(init_disableRibbomButton, "sp.ribbon.js");
});
function init_disableRibbomButton()
@MudassarAli
MudassarAli / gitcom.md
Last active September 11, 2020 09:27 — forked from jednano/gitcom.md
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

$ git init
@MudassarAli
MudassarAli / RegisterEventLog.ps1
Created March 22, 2018 13:27 — forked from DanSmith/RegisterEventLog.ps1
Powershell script to register a windows event log source
# https://github.com/dansmith
#
$source = "My Application Name"
$wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp=new-object System.Security.Principal.WindowsPrincipal($wid)
$adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator
$IsAdmin=$prp.IsInRole($adm)
@MudassarAli
MudassarAli / GetTokenFromIDP.ps1
Last active March 9, 2018 15:20 — forked from johnkors/GetToken.ps1
Fetch an accesstoken from IdentityServer3 using PowerShell 3
<#
.SYNOPSIS
Fetches an access token using the IdentityServer3 token endpoint
.DESCRIPTION
Modify the parameters so it matches your IdentityServer3 instance.
.NOTES
File Name : GetToken.ps1
Author : John Korsnes (@johnkors, johnkors)
Prerequisite : PowerShell V3
.LINK
@MudassarAli
MudassarAli / LS.SP.JSOM.js
Created July 9, 2017 10:11 — forked from zplume/LS.SP.JSOM.js
SharePoint 2013 REST / JSOM / Utility functions (work in progress)
(function() {
var nsName = "LS"; // root namespace name
var ns = window[nsName]; // root namespace alias
var utils = ns.Utils; // utils alias
ns.SP = ns.SP || {};
ns.SP.JSOM = {
Data: {
Sites: {} // cache for Taxonomy terms JSON
},