Last active
May 15, 2018 20:35
-
-
Save dmadelung/67e83c37e46c96db1c7913bae98d3fba to your computer and use it in GitHub Desktop.
This file contains 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
$terms = @() | |
#set terms | |
$terms = "Term1","Term2" | |
#set mm field | |
$mmfield = 'MM' | |
#get term info | |
$tg = Get-PnPTermGroup -Identity "Site Collection - drewmadelung.sharepoint.com" | |
$ts = Get-PnPTermSet -TermGroup $tg -Identity "TermSet" | |
$var = @{ | |
$mmfield = @() | |
} | |
#add terms to table | |
$terms.ForEach({ | |
$t = Get-PnPTerm -Identity $_ -TermGroup $tg -TermSet $ts | |
foreach($key in $($var.keys)){ | |
if($key -eq $mmfield){ | |
$var[$key] += $t.Id.ToString() | |
} | |
} | |
}) | |
#set item | |
Set-PnPListItem -List $list -Identity 4 -Values $var -SystemUpdate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment