Created
February 8, 2024 15:07
-
-
Save bjoerntx/bbcb706083f3ef61ada2306d2f3400d5 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
private static void RenameMergeFields(ApplicationFieldCollection applicationFields, | |
string oldColumnName, | |
string newColumnName) | |
{ | |
// iterate through all ApplicationFields | |
foreach (ApplicationField applicationField in applicationFields) | |
{ | |
// check if the ApplicationField is a merge field and contains the old column name | |
if (applicationField.TypeName == "MERGEFIELD" && | |
applicationField.Name.Contains(oldColumnName)) | |
{ | |
// create a new MergeField object and replace the old column name with the new column name | |
MergeField mergeField = new MergeField(applicationField); | |
mergeField.Name = mergeField.Name.Replace(oldColumnName, newColumnName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment