Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I wrote a script with ECMAScript to create a new calendar view with a click of the button by using:

this.viewCollection.add(viewInfo);

However, I'm wondering if it is possible to create the view based on an existing view so that all the view fields information can be carried over (scope, filters...)

Thanks in advance!

share|improve this question
add comment

2 Answers

You can use the SP.View.viewQuery property to fetch the query of the existing view.

And assign that query to the new view by using the SP.ViewCreationInformation.query property.

Example:

viewInfo.set_query(yourOriginalView.get_viewQuery());
share|improve this answer
add comment

You should be able to copy most of the properties from an existing view, but it's going to be a three step process:

  1. Get the exiting View
  2. Fill out properties available in the ViewCreationInformation and create the view
  3. Update the propertites of the new View which wasn't available in ViewCreationInformation and update the View
share|improve this answer
    
... and two calls to the server. –  Mike H May 24 '12 at 2:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.