Skip to content

Instantly share code, notes, and snippets.

View GetQueryStrings.js
const queryStrings = window.location.search.substring(1).split("&").reduce((output, item, index) => {
if(item === "")
return output;
const keyValue = item.split("=");
output[decodeURIComponent(keyValue[0])] = keyValue[1] !== undefined ?
decodeURIComponent(keyValue[1]) :
true; // return true for query strings with no value
View Create-MailEnabledSecurityGroups.ps1
param(
# Credentials paramter should be a variable containing the result of Get-Credential
[Parameter(Mandatory = $true)]
[pscredential]$Credentials,
[Parameter(Mandatory = $true)]
[string]$ConfigFile
)
$ErrorActionPreference = "Stop"
@zplume
zplume / FunctionAppMap.ps1
Last active Dec 16, 2018
Get-AzureFunctionKeys.ps1 retrieves Azure Function auth. codes for the Functions specified in FunctionAppMap.ps1, using the Azure REST API and user credentials. This script uses Get-AADToken.ps1 (https://gist.github.com/zplume/574e133b43ecf3037473286580ed524e) to retrieve an Azure access token.
View FunctionAppMap.ps1
# Map Function App friendly name to URL
return @{
DEV = @{
"CreateTenderSite" = "https://dev-createtendersite.azurewebsites.net";
"CopyDocuments" = "https://dev-copydocuments.azurewebsites.net";
"Notifications" = "https://dev-notifications.azurewebsites.net";
"PermissionAssignment" = "https://dev-permissions.azurewebsites.net"
};
TEST = @{
View Get-AADToken.ps1
# Original code from https://github.com/slavizh/OMSSearch/blob/master/OMSSearch.psm1
# - Updated/fixed authentication method calls
# - Ensure ADAL DLL is loaded
Function Get-AADToken {
<#
.SYNOPSIS
Get token from Azure AD so you can use the other cmdlets.
.DESCRIPTION
Get token from Azure AD so you can use the other cmdlets.
View Get-PnPListItemRoleAssignmentDefinitionBindings.ps1
param(
[Parameter(Mandatory = $true)]
[string]$ListTitle,
[Parameter(Mandatory = $true)]
[int]$ItemId,
[Parameter(Mandatory = $true)]
[string]$Path
)
@zplume
zplume / Update-Flows.ps1
Last active Oct 25, 2018
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.
View Update-Flows.ps1
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)
View Using the Parse JSON action to set headers for SharePoint Online REST requests in Microsoft Flow.md

Using the Parse JSON action to set headers for SharePoint Online REST requests in Microsoft Flow

About

This is useful in combination with the SharePoint - Send an HTTP request to SharePoint action.

This could be expanded to include other combinations of header values, but this is what I've used so far:

Set Headers

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

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:

View Cross-site collection file copy with SharePoint Online REST APIs in Microsoft Flow.md

Cross-site collection file copy with SharePoint Online REST APIs in Microsoft Flow

About

This is a follow up to my previous post: Moving Files with SharePoint Online REST APIs in Microsoft Flow, which explains how to move/copy files with Microsoft Flow using the SharePoint - Send an HTTP request to SharePoint action and the SharePoint Online SP.MoveCopyUtil REST API.

This post demonstrates using a similar approach, but using the CreateCopyJobs and GetCopyJobProgress APIs to copy files from one site collection to another.

I suggest reading the previous post first for context if you haven't already.

View Moving Files with SharePoint REST APIs in Microsoft Flow.md

Moving Files with SharePoint Online REST APIs in Microsoft Flow

About

This is an overview of how to move files with Microsoft Flow using the SharePoint - Send an HTTP request to SharePoint action and SharePoint Online REST APIs.

These SharePoint Online REST APIs can be used outside of Flow, but you will need to handle authentication and provide an X-RequestDigest header with any POST requests (as with any SP REST POST request).

In the case of Flow's SharePoint - Send an HTTP request to SharePoint action, authentication is handled for you and you do not need to provide the X-RequestDigest header.

You can’t perform that action at this time.