Skip to content

Instantly share code, notes, and snippets.

@OlafD
Created March 24, 2019 10:57
Show Gist options
  • Save OlafD/a507b45982a1d27a01b62634590c3622 to your computer and use it in GitHub Desktop.
Save OlafD/a507b45982a1d27a01b62634590c3622 to your computer and use it in GitHub Desktop.
Move the field to the position behind another field in a content type. This script makes use of two other script files stored as gists.
function MoveFieldBehind
{
param (
[string]$ContentTypeName,
[string]$FieldToMove,
[string]$AnchorField
)
Write-Host "Put field $FieldToMove behind $AnchorField in Content Type $ContentTypeName"
$pos = . ..\Common\GetFieldPositionInContentType.ps1 -ContentTypeName $ContentTypeName -FieldName $AnchorField
$pos++
. ..\Common\ReorderContentTypeFields.ps1 -ContentType $ContentTypeName -FieldName $FieldToMove -Mode Position -NewPosition $pos
}
MoveFieldBehind -ContentTypeName "Company Data" -FieldToMove "CompanyPrimary" -AnchorField "SharingCompany3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment