Search code examples
sharepointwindows-sharepoint-services

SPView.Clone Method


I'm showing a view within a webpart and I update this view to filter the list items according to the logged on user's groups. Is there a way to clone the view and update it leaving intact the original one? I need this cloned view to be temporarary since I don't need it after rendering it.
I know there's a SPView.Clone method but it's little documented...


Solution

  • I believe the clone-d view will be persisted to the database. You can take a look at ListViewByQuery class.

    EDIT: An example + explanation can be found here: http://karinebosch.wordpress.com/sharepoint-controls/the-listviewbyquery-control/ (this even shows how to use grouping in such views)