Skip to content

Instantly share code, notes, and snippets.

@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)

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

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:

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.

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.

@zplume
zplume / Set-PnPListAllowDeletion.ps1
Last active June 19, 2018 21:16
Script to update the AllowDeletion property of a SharePoint List. Assumes you have already connected to the relevant site with Connect-PnPOnline.
param(
[Parameter(Mandatory = $true)]
[string]$ListTitle,
[Parameter(Mandatory = $true)]
[bool]$AllowDeletion
)
$list = Get-PnPList -Identity $ListTitle
$list.AllowDeletion = $AllowDeletion
$list.Update()
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
},
"$authentication": {
"defaultValue": {},
# This script creates a set of modern team sites without an associated Group from a CSV file,
# using the New-SPOModernTeamSite.ps1 script.
# The script must be run from the SharePoint Online Management Shell and
# you must connect to your SharePoint tenant admin URL with Connect-SPOService before running it.
param(
# Path: Path/File name of a CSV file that contains populated Title, Url, Owner and AdditionalOwner columns
[Parameter(Mandatory = $true)]
[string]$Path
$tenantUrl = "https://yourtenant.sharepoint.com"
$credentials = Get-Credential
Connect-PnPOnline -Url $tenantUrl -Credentials $credentials
$sites = Get-PnPSiteSearchQueryResults -All
Disconnect-PnPOnline
$script:wfStatuses = @()
function Get-WebWorkflowData($web) {
Remove-Item d:\home\site\wwwroot\* -recurse