Skip to content

Instantly share code, notes, and snippets.

@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active July 31, 2025 20:51
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@kaffeskogen
kaffeskogen / SharePoint chrome snippet boilerplate.js
Last active February 10, 2023 07:17
SharePoint chrome snippet boilerplate.js
(async () => {
console.log('starting...');
const siteUrl =
location.href.split('/')
.slice(0, location.href.toLowerCase().includes('/sites/') ? 5 : 3)
.join('/');
if (!window.SP) {
for (const fileName of ['init.js','MicrosoftAjax.js','SP.Runtime.js','SP.js']) {
@zplume
zplume / Update-Flows.ps1
Last active June 29, 2023 07:35
PowerShell script to update multiple Flows that have been exported from one environment for deployment to another environment. The script will unzip a set of Flow zip files from a source directory into a temp folder, replace source values with destination values, then save updated zip files into a destination directory.
param(
[Parameter(Mandatory = $true)]
[string]$SourceEnv,
[Parameter(Mandatory = $true)]
[string]$DestinationEnv
)
$ErrorActionPreference = "Stop"
# Note: these values could be loaded from elsewhere, e.g. CSV/XML (or dynamically if you want to get fancy)

Retrieving list item changes with the SharePoint Online Folder.GetListItemChanges REST API in Microsoft Flow

About

This post demonstrates how to retrieve SharePoint list item changes in Microsoft Flow using the SharePoint - Send an HTTP request to SharePoint action and the SharePoint Online Folder.GetListItemChanges REST API.

Why

This is something I started looking at after reading this set of tweets by John Liu:

@phillipharding
phillipharding / CreateOfficeDocument.js
Last active October 24, 2017 12:48
Creates an Office Document in a SharePoint Document Library using the supplied Office Document Template, then opens the edit properties dialog of the new document.
/** Creates an Office Document in a SharePoint Document Library using the supplied Office Document Template
* see: https://msdn.microsoft.com/en-us/library/dd958478(v=office.12).aspx
* @param {} newDocumentName - empty or the new document filename
* @param {} listName - the target list (ID) in the form {A28BF06E-1374-4858-9D35-62C5904B8503}
* @param {} docType - Microsoft.SharePoint.Client.DocumentTemplateType
* - Invalid=0, Word=1, Excel=2, PowerPoint=3, OneNote=4, ExcelForm=5
* @param {} templateUrl - the absolute/server relative URL of the document template (can be template or document)
* @param {} waitUI - optional, the notification handle of a wiat dialog to close
* e.g.
* var waitUI = SP.UI.ModalDialog.showWaitScreenWithNoClose('Creating Document...', "Please wait, this shouldn't take long...", 100, 380);
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl