I am trying to figure out why my code isn't working correctly. I am simply trying to create a function that will change a field name to something else in MOSS 2007.
The specific use here is to change the default "Title" field name to "Term" in a custom list. No error is thrown, code excutes as though it worked but in fact does not.
Public
Shared Function PFRenameField(ByVal PFOldFieldName As String, ByVal PFNewFieldName As String, ByVal PFCurWeb As SPWeb, ByVal PFCurListName As String) As BooleanTry
Dim PFField As SPField = PFCurWeb.Lists(PFCurListName).Fields(PFOldFieldName)
PFField.Title = PFNewFieldName
PFField.Update()
PFReportDebug("PFRenameField", PFOldFieldName & " to " & PFNewFieldName & " in " & PFCurListName)
Catch ex As Exception
PFReportError("PFRenameField", ex.ToString)
Return False
End Try
Return True
End Function

Change "Title" Field's name to anything else in a Custom List.
Jason Saunders
ImagineNation
have you tried updating the list object instead
field.Title = "this is the new title";
field.Update();
list.Update();