Override ListViews in all Lists.


  • Hello. First I want to say that I don't want to create custom webpart with custom list view, this is not a problem. I need to override all ListViews in all Lists in my SiteCollection. So for example you have custom list with ten different views. In all these views you can see field Title. But I need to hide this field for some users. So I think the only solution is to create some custom library and override some methods which generate all these views...Hmm....Can you please help me with this....

    For example to hide fields in new/edit/display form I work with ListFieldIterator and IsFieldExclued...Hmm Is something like this for ListViews..

    PS: I don't want to use any third party products I want to create this by my self or whit yoru help:) Thank you

    1 พฤษภาคม 2555 18:31


  • Hi,

    You can remove a field from the list view in SharePoint 2010 using Client Object Model:


    string siteUrl = "Yoursiteurl";

                ClientContext clientContext = new ClientContext(siteUrl);
                ListCollection collList = clientContext.Web.Lists;


                foreach (SP.List oList in collList)


                    SP.View view = oList.Views.GetByTitle("All items");

                    ViewFieldCollection viewFields = view.ViewFields;



    Please note that the internal name of the Title-field is "LinkTitle".

    Xue-mei Chang

    TechNet Community Support

    • ทำเครื่องหมายเป็นคำตอบโดย Xue-Mei Chang-MSFTModerator 13 พฤษภาคม 2555 13:09
    • ยกเลิกการทำเครื่องหมายเป็นคำตอบโดย enti3333 21 มิถุนายน 2555 6:44
    3 พฤษภาคม 2555 6:33
  • Hello.
    Thank you very much for this solution but I need something else because I need  override listview when it's generating. For example I want that field is visible only for administrators and for other users not. I need to override webpart class which generate these views...Hmm...Is this possible somehow. Thank you
    3 พฤษภาคม 2555 7:48