Wanted to record a quick demo for how to switch from the current established “SharepointPnPPowerShellOnline” module into new “PNP.PowerShell” module based on .Net Core. Shout out to @ToddKlindt for the great blog post. Cmdlets and references below. Cheers
Wanted to share quick tutorial on how to parse InfoPath attachment XML. Source Form Library contains XML with Base64 encoded attachments which we can parse into local TEMP folder and then upload to destination Document Library. Extract filename and file content for each InfoPath attachment XML node. Save into subfolders and match original file naming. Helpful for Office 365 migration and scenarios where InfoPath client is no longer available and users prefer to view attachments directly.
Quick post about detecting if PowerShell PNP is available on the local PC and installing is missing (for new systems) to make PS1 script more portable across servers.(1) Detect command (2) Install module if missing (3) Import module. Cheers
Video
Code
# Load PNP module, the right way
Add-Type -Assembly "System.IO.Compression.FileSystem" -ErrorAction SilentlyContinue | Out-Null
$pnp = Get-Command Connect-PnPOnline -ErrorAction SilentlyContinue
if (!$pnp) {
Install-Module "SharePointPnPPowerShellOnline" -Force
}
Import-Module "SharePointPnPPowerShellOnline" -ErrorAction SilentlyContinue | Out-Null
When making bulk data changes to SharePoint List or Library you may need to temporarily turn off Required fields. Opening this can allow us to import records, apply changes, and modify metadata without prompting that required fields are missing. PowerShell below can help disable all Required fields OFF. Script generates a CSV snapshot of prior configuration during run. CSV can be used to restore original configuration for which fields are Required.