Upgrading list views without changing the underlying list

driAn
  • Upgrading list views without changing the underlying list driAn

    What is the best way of updating views on a production environment? Assume you roll out a second version of your sharepoint solution and you want to add/modify the views on the list, but you can't just redeploy the list, because it contains production data.

    Is it a good idea to update the views via the sharepoint object model? Or are there better ways to update views without touching the underlying list?

    Thanks for any advice.

    Update:

    I accepted Anders Rasks answer. However I'm still looking for a simpler (more efficient) approach for view upgrades. Please post if there is a new solution for this out there... Thanks

  • To do this i would recommend programmatically adding a view programmatically. You should do this in a feature call-out. Make the feature dependable on the original feature that created the view to avoid race conditions if you later decide to activate both features on a new site or need to recreate your farm.

    In general i have moved away from doing lists and views declaratively as much as possible. Its only a few lines of code compared to a bucket full of CAML spit ;-)

    Programmatically adding views is done using SPViewCollection.Add method. Heres a good example from SharePoint DEV Wiki: Creating a List View programmatically using the object model

    More on creating call-outs from a feature receiver: http://www.sharepointdevwiki.com/display/public/How+to+add+a+Feature+Receiver+to+a+Feature

    EDIT: SharePoint 2010 supports versioned features. This will allow you to branch updates based on feature version. One option is to add fields to existing content types:

    hth Anders Rask

  • Depending on what your application is, once you're in production the application is going to be changing dynamically due to user activity (assuming it's at all successful). Why wouldn't you just go to the SharePoint UI and make the changes to the view there? Is this a case of over-developer thinking or am I missing a requirement?

  • you can also create view on dev/staging environment and then copy ASPX file to the production.Just be sure to set correct list guid.

Tags
list-view deployment
Related questions and answers
  • ; But Body always comes back blank. I have two site collections; one to test and one for production. The Test collection works and returns the body of the announcement, but the Production does not. What should I be looking for? What could I have customized? Our admin does not yet have the latest service pack installed, nor do I get much of anything out of them support wise. ...I can create a CQWP for the Announcement content type, but when I export the .webpart and add <property name="CommonViewFields" type="string">Expires,Date;Body,text</property> In my

  • I've created a custom list in SharePoint 2010 from a custom content type (inherit from item) and I would like to give the users the option to order the items in this list - similar to how users can order items in an out of the box Links list. In SharePoint 2007 I did this several times by using the OrderedList property in the List element of the schema.xml, and I've tried the same approach in 2010. I also added the OrderedView property on the View element. After creating a list from this defintion, when I look at the list settings and attempt to modify a view then I see the options

  • work either. I should be able to do it by more heavily customising the List Definition, but that seems a little over the top and I'm reluctant to do that before ruling out the other options. So...I've been hitting my head against a wall on this one for the last couple of days. I have a pretty simple requirement but I cant see how it can be achieved within a Sandboxed solution. I'm depressed..., and then as part of that activation, drop web parts onto some specific pages. In my case I want to be able to drop it onto the "AllItems.aspx" page of a list, but I'm equally having trouble adding

  • any development experience in Sharepoint I can't really say which ones are going to be imperative for my application. I would like to do it on Foundation, because I can re-sell the app without...I'm about to start developing a custom business application on top of Sharepoint 2010. I haven't done anything on this product but client insists on it so I don't have a choice. Application info I..., but as this app will run under Sharepoint all this will be done by it. I won't have to handle authentication/authorisation. Application will run processor intensive business processes and it will support three

  • sites/sub-site and permission level. My question is: Is this possible? Another question: Is there any method how to get this information without installing anything on server side of SharePoint farm? I have list of sites and sub-sites with URL's. More details: Let me describe one solution I have now. I’ve found tool Data Juggler (http://www.djuggler.com/) which can automate repetitive web tasks...Where is information about users associated with specific SharePoint site stored? I guess information is stored in relational database. To be more specific i want to ask if it is possible to query

  • " maxRequestLength="104856" /> After searching I found https://stackoverflow.com/questions/1580085/show-webpage-has-expired-on-back-button. Well, obviously I can’t use GET because I am developing a web part NOT a page. Also, it is not possible to oblige the clients to change their forms from POST to GET just to use my little web part (I think you understand me). I put a breakpoint inside the web part and tried to reproduce the same error. The results: it doesn’t hit the breakpoint. Also, I checked the EventViewer and no errors there. Please help me out in this issue, note that my control

  • I'm a starting sharepoint developer asked to implement the following scenario in sharepoint 2010. We're a bit lost on the best approach to get started.. I'm really struggling to find the best practise solution. This is the requested flow: A user can make a request with a title and a description. A mail gets sent to the representative with a link to a form. A representative can approve... by the representative, the board can approve or reject the request. A mail gets sent to the user and the representative with the descision of the board. So the list has the following fields: Request

  • . Note that this is just opening the Excel file without checking it out. Problem: Once in a while, and for no reason I can figure out, a user will click the button and the spreadsheet will be returned... is causing this behavior? I can change the code to avoid it if I can figure out why it is happening. Is there any way through the SharePoint UI or APIs to "release" the document so that the original... into it. Either way, it then opens the file in Excel. The code to open the file is some client-side script that figures out the location of the Excel file in SharePoint, sets an href variable to that URL

  • I created a Calendar List and a Project Tasks list. Then I added a lookup from the Tasks list to the Calendar list. However, when I try to connect the two with the related field visible on both List View WebParts, the connection is greyed out. How do I make this work? There is very little information available on connecting WebParts on a web part page. This seems to be too advanced a topic for most of the end user resources. On the other hand, it's not a developer or IT Pro topic either. The Administrator's Companion and the "SharePoint 2007 User's Guide" by Seth Bates both have one page

Data information