How do I reorder the fields/columns in a SharePoint view? -


i'm adding new field list , view. add field view, i'm using code:

view.viewfields.add("my new field"); 

however tacks on end of view. how add field particular column, or rearrange field order? view.viewfields spviewfieldcollection object inherits spbasecollection , there no insert / reverse / sort / removeat methods available.

i've found removing items list , readding them in order i'd works (although little drastic). here code i'm using:

string[] fieldnames = new string[] { "title", "my new field", "modified", "created" }; spviewfieldcollection viewfields = view.viewfields; viewfields.deleteall(); foreach (string fieldname in fieldnames) {     viewfields.add(fieldname); } view.update(); 

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 -