Sitecore powershell copy from one General Link field to another
We have requirement to copy from one general link url to another field.
$allitems=Get-ChildItem
-Path 'master://sitecore/content/Global -Recurse | Where-Object {
$_.TemplateName -eq "Relatedcontent" }
$allitems | ForEach-Object {
[Sitecore.Data.Fields.LinkField]$field =
$_.Fields["Navigation Link"]
[Sitecore.Data.Fields.LinkField]$fieldnew
= $_.Fields["Navigation Link1"]
$_.Editing.BeginEdit()
$fieldnew.LinkType= $field.LinkType
$fieldnew.TargetID=$field.TargetID
$fieldnew.Url =$field.Url
$_.Fields["NavigationTitle1"].Value=$_.Fields["NavigationTitle"].Value
$_.Editing.EndEdit() | Out-Null
Write-Host $_.FullPath
}
Comments
Post a Comment