Make SharePoint 2007 List View read-only
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?
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
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
精彩评论