sharepoint 2007 - Site column does not get deleted -


i have site column delete programatically using following code. have removed references field previously. however, if there not error, goes fieldtodelete.delete() , steps through next line. however, when check site column collection using spm2007 or via ui site column still there.

        dim fieldtodelete spfield         try             fieldtodelete = site.rootweb.fields.getfieldbyinternalname(name)             'site.rootweb.fields.getfieldbyinternalname(name)             fieldtodelete.delete()         catch ex exception              console.writeline("field: {0} not deleted", name)             return 0         end try 

any ideas on why sharepoint this? also, there 2 fields same name, not sure if has direct effect on this. want delete both.

thanks

since there 2 fields same name, internal names different name. sure line

fieldtodelete = site.rootweb.fields.getfieldbyinternalname(name) 

is returning valid spfield? if not, need find internal names of fields, don't match names.

edit: since said getting fields back, realized aren't calling site.rootweb.update() after deleting field. should fix issue.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -