This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copies choice values from a SharePoint document library source column and adds them (when present in the term store) as tags to a target column | |
# Will not increment version history or modify modified/modified by columns | |
# Define constants | |
$SiteUrl = "https://your-tenant.sharepoint.com/sites/site-name" | |
$ClientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # This should be the guid of your tenant's registered PnP Powershell module | |
$ListName = "Library Name" | |
$SourceColumn = "SourceColInternalName" # This field should be of type 'Choice' or 'MultiChoice' | |
$TargetColumn = "TargetColInternalName" # This field should be of type 'TaxonomyFieldType' or 'TaxonomyFieldTypeMulti' | |
$TermGroupId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # The guid of the term group containing the tags that should be referenced |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Function to copy values from one column to another in a list or document library (target column should be same type as source column) | |
#From https://www.sharepointdiary.com/2019/05/sharepoint-online-copy-values-from-one-column-to-another-using-powershell.html | |
#The account running the script needs to have edit permissions to the site or library | |
#Define constants | |
$SiteUrl = "https://your-tenant.sharepoint.com/sites/site-name" | |
$ClientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # This should be the guid of your tenant's registered PnP Powershell module | |
$ListName = "Library Name" | |
$SourceColumn = "SourceColInternalName" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generic script to loop through rows of a SharePoint list/library to make modifications to column values | |
#Define constants | |
$SiteUrl = "https://your-tenant.sharepoint.com/sites/site-name" | |
$ClientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # This should be the guid of your tenant's registered PnP Powershell module | |
$ListName = "Library Name" | |
#Connect to SharePoint Online site | |
Connect-PnPOnline $SiteUrl -Interactive -ClientId $ClientId |