Editing SPView objects

SharePoint Short #14

Making a change to a SPView object directly will not work:

listObject.DefaultView.Title = "new title";
listObject.DefaultView.Update();

What you should do is instantiate a new variable from the view you want to make changes to:

SPView view = listObject.DefaultView;
view.Title = "new title";
view.Update();
This entry was posted in SharePoint Shorts and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve the maths problem shown below before posting: *