Skip to content

Instantly share code, notes, and snippets.

@craigm26
craigm26 / AllContentTypesSplit.ps1
Created April 11, 2025 18:54
Export All SharePoint On-Premises Content Types
<#
.SYNOPSIS
Splits a large AllContentTypes.json file into smaller files organized by SiteURL.
.DESCRIPTION
This script processes a very large JSON file line by line without
loading the entire file into memory. It organizes content types by SiteURL
and creates separate JSON files named after each site.
.PARAMETER InputFile
The path to the AllContentTypes.json file.
.PARAMETER OutputFolder
@craigm26
craigm26 / MigrateSingleContentType2016toSPOGist
Created April 11, 2025 18:47
SharePoint On-Premises to SharePoint Online Content Type Hub Migration
<#
.SYNOPSIS
Migrates a single content type from SharePoint 2016 to SharePoint Online Content Type Hub.
.DESCRIPTION
Run the output content type script (not included here) for a JSON document specific to a given site - usually the content type hub of on-premises.
This script connects to both SharePoint 2016 and SharePoint Online environments,
retrieves a specified content type from the on-premises environment, and creates/updates
it in the SharePoint Online Content Type Hub. This script should be run from within the 2016 app server that has Microsoft's SharePoint Management Shell installed.
.PARAMETER SourceSiteUrl
@craigm26
craigm26 / UpdateSiteAdministratorOneDrive.ps1
Last active July 3, 2024 18:57
SharePoint Online: Update Site Administrator for all tenant OneDrives
# Import PnP PowerShell module to interact with SharePoint Online - if not already installed, run Install-Module PnP.PowerShell
Import-Module PnP.PowerShell
# Step 1: Connect to the SharePoint Admin Center
Connect-PnPOnline -Url https://yourtenantdomain-admin.sharepoint.com -Interactive
# Specify the email address to remove
$emailToRemove = "user@example.com" # replace with the email address you want to remove
# Step 2: Retrieve all OneDrive site URLs
@craigm26
craigm26 / AdobeCommandSet.ts
Last active July 19, 2024 16:10
SharePoint Adobe integration library extension
# Goal: replicate the deprecated SharePoint-Adobe Integration
# setup 2 text columns in SharePoint where this action needs to be performed: "Adobe Sign Status" and "AgreementId"
# start a regular typescript project for SharePoint with the command set for library extensions.
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api
# have a (supposedly deprecated) Adobe Integration key handy.
https://na3.documents.adobe.com/account/accountSettingsPage#pageId::ACCESS_TOKENS
# you can use the client-to-server authentication method for app id and thats fine. Be wary of user clicks.