views:

327

answers:

3

I need to deploy a new List View for the standard List View Web Part in MOSS 2007 via the object model (the list already exists, a new view should be added). I need and want to make this list view read-only. This is because saving changes to the view would corrupt modifications made to Header/Footer.

How can I do that via the object model? I looked at the content db, the read-only flag (0x20) is stored with the view and could technically be updated using calls to proc_GetAllWebPartsOnPage and proc_UpdateView[Properties]. NOTE: The database interface and all mentioned stored procs are all documented by Microsoft.

Is there ANY way to do that via the object model, because I would strongly prefer that?

A: 

Not sure I 100% understand your question... Options though could be to create an EventHandler and then when the handler fired on the ItemUpdating event, cancel the update. You could also deploy a custom form for the list that does not allow for updates to be initiated from the UI.

John

John Ptacek
Hi John, the definition of the view (columns, CAML query, sorting, grouping et al) should be read-only (views can be edited by default at least by users with sufficient permissions), not the list.What's the netiquette here ... upvote if it is a correct answer to a different question?Thanks anyway
FireSnake
+1  A: 

I don't think this is possible with the object model. You can set a view to be read only if it is defined in CAML as part of a list definition, but I don't think you can change this once a view has been created.

The following article was written for WSS 2.0, but i think the same applies for 3.0.

http://support.microsoft.com/default.aspx/kb/929263?p=1

Paul Lucas
A: 

Google tells me SharePoint View Permission is not a out of the box feature. So, obviously, either by custom code or web part. Below are two resources which may come handy! SharePoint Web parts SharePoint Column View Permission.
Custom code: http://geekswithblogs.net/naijacoder/archive/2008/04/16/121300.aspx

skyflyer