1

I was told that this was not possible but wanted to run this by here.

Is it possible to create a script that can take library views from one library and add it to another library on the same site?

In addition, is this possible to do the same and move views from one library to a different site or collection?

1

Instead of going to the hassle of creating Views with code you could operate on the ViewEdit page

extract which fieldnames are checked, save them to the browsers localStorage, open another ViewEdit page, set the desired Checkboxes based on localStorage

    document.querySelectorAll("input[type='checkbox']").forEach(function(field){
       console.log(field.name);
       if (field.checked) ....
    });

If you create BookMarklet or use something like GreaseMonkey you can automate it further

0

It seems like you should be able to do this with powershell. You'd have to get the parameters and their values from the original list, then create the new view using ViewFields and Query from the original list.

This article should get you started.

0

Another option is to use SharePoint Designer (Provided both lists has the Same Field names)

  1. Open designer and navigate to All Files -> Lists
  2. Expand List1 and copy the view aspx file
  3. Expand List2 and paste
  • From this approach it requires that both lists or libraries need to have the same field names. Did I get that right? – Aspire27 Jul 18 '16 at 19:21
  • Yes. That is correct. – Amal Hashim Jul 18 '16 at 19:44
  • There are GUIDs inside the view files. Won't those mess it up? – Erin L Jul 18 '16 at 20:07
  • Before posting I tested on a custom list and it worked. – Amal Hashim Jul 18 '16 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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