#Parameter
$URL = "https%3A%2F%2Fcrescent.sharepoint.com%2Fsites%2Fmarketing%2F2018%2FDocuments%2FInfo%20Mgmt%20v2%2Epdf"
#Decode URL
[System.Web.HttpUtility]::UrlDecode($URL)
#Output:
https://crescent.sharepoint.com/sites/marketing/2018/Documents/Info Mgmt v2.pdf
$EncodedURL = "https%3A%2F%2Fcrescent.sharepoint.com%2Fpersonal%2Fsalaudeen_crescent_com%Documents%2FAssets%20%26%20Inventory.xlsx"
[system.uri]::UnescapeDataString($EncodedURL)
#Import PoweShell Module for SharePoint Online
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
#Function to Decode URL
Function Decode-URL([string]$URL)
{
Try {
#Decode the URL
Return [Microsoft.SharePoint.Client.Utilities.HttpUtility]::UrlKeyValueDecode($URL)
}
catch {
Return "Error Getting De-codedURL: $($_.Exception.Message)"
}
}
#Parameter
$URL = "https%3A%2F%2Fcrescent.sharepoint.com%2Fsites%2Fmarketing%2F2018%2FShared%20Documents%2FInformation%20Management%20v2%2Epdf"
#Call the function to decode URL
Decode-URL $URL
Encode URL in PowerShell
$URL = "https://crescent.sharepoint.com/personal/salaudeen_crescent_com/Shared Documents/Assets & Inventory.xlsx"
Write-host([URI]::EscapeUriString($URL))

$URL = "https://crescent.sharepoint.com/personal/salaudeen_crescent_com/Shared Documents/Assets & Inventory.xlsx"
[System.Web.HttpUtility]::UrlPathEncode($URL)
