Refactor taxonomy term parsing and remove redundant code in migration script

This commit is contained in:
Torsten Brendgen
2026-04-16 16:33:32 +02:00
parent 68d7ca6755
commit 6c5236a405

View File

@@ -1942,11 +1942,8 @@ function Convert-ToTaxonomyTermEntries {
$label = $matches[1]
$termGuid = $matches[2]
}
else {
$parsedGuid = [Guid]::Empty
if ([guid]::TryParse($rawTermString, [ref]$parsedGuid)) {
$termGuid = $rawTermString
}
elseif ([guid]::TryParse($rawTermString, [ref]([guid]::Empty))) {
$termGuid = $rawTermString
}
}
@@ -2187,14 +2184,6 @@ function Set-SPItemFieldValue {
try {
switch ($field.TypeAsString) {
"TaxonomyFieldType" {
Set-SPTaxonomyFieldValue -Item $Item -Field $field -RawValue $RawValue -TextValue $TextValue
return
}
"TaxonomyFieldTypeMulti" {
Set-SPTaxonomyFieldValue -Item $Item -Field $field -RawValue $RawValue -TextValue $TextValue
return
}
"Boolean" {
$Item[$field.InternalName] = Convert-ToBoolean -RawValue $RawValue -TextValue $TextValue
return