6

I have a bunch of views to create for a couple libraries that are all basically the same except for some filter values. I can create them in PowerShell using ViewCreationInformation. After a bit of trial and error I got this working, my views look how I want them, except for one thing. I don't want the default tabular view property set.

Is there a CSOM option somewhere to disable this? I'm looking through the View information and I am not seeing anything jump out at me. Is this settable through code or am I stuck having to manually go back and edit each view after the fact to disable this?

Edit: Looking at the server SPView class, it shows as a property so it appears that it is not yet implemented in the SharePoint Client Object Model. Knowing that, I'd accept any possible work arounds, JSLink, jQuery, CSS, etc.

  • Hi. I was looking for but it seems not be supported. Would it be possible to develop a solution based on the JSLink of the view? – Juan Pablo Pussacq Laborde Apr 6 '16 at 14:34
  • I suppose, but I'd rather not in this particular case. An answer with it isn't currently supported and a JSLink workaround would allow for me to accept an answer. – Eric Alexander Apr 6 '16 at 14:38
  • It's stored in the ListViewXml, by default its not in there, but if you set it to false in the GUI you'll notice the View node will get an attribute TabularView (or something) = "FALSE". But I didn't have any luck reflecting the changes I do, it does not update. Maybe it has to be done through the LimitedWebPartManager somehow. – Anders Aune Apr 6 '16 at 21:35
  • @AndersAune I noticed this as well, I'm going to try a last ditch effort of using SPServices and the SOAP web services to see if I can set it, spservices.codeplex.com/wikipage?title=UpdateView. – Eric Alexander Apr 7 '16 at 0:36
  • Yeah, maybe better luck with that, interested in your result. I didn't have any luck with the XmlDefinition on the LimitedWebPartManager either. – Anders Aune Apr 7 '16 at 5:58
3

As I can't stand my half answer in the comments..

I used TamperMonkey (the Chrome version of FireFox GreaseMonkey) to automate the manual proces. It detects the ViewEdit page, checks the darn checkbox, unchecks it if needed, and saves the View... But I misplaced the code :-( If you open those 300 Views in Tabs, Tampermonkey will fire on all and you can sit back and have a beer (You would have to down it fast.. 300 pages is done in minutes)

Here is the recreated Tampermonkey script

Important part is the wildcard match on the URL,

Now all you have to do is create the URLs to those 300 Views and use window.open

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://365csi.sharepoint.com/sites/iCSR/_layouts/15/ViewEdit.aspx*
// @grant        none
// ==/UserScript==

(function() {
    document.getElementById('TabularViewAllowed').checked=false;
    DoValidateAndSubmit();
})();

You might need to wrap it in a 1000 milsec setTimeout.. if only so you can enjoy that beer

This will fire always; you could also wrap the 2 lines in a Bookmarklet so its available on your favorites bar with one click.

Automating things with Tampermonkey can be fun (once your script works)

Every friday I kick off a script on the Windows App Store and built www.OfficeAppCoach.com

with one click ... and two beers

Great insights... a whopping six Apps where added last week.. and only one for SharePoint

https://gyazo.com/5a83e401848a49535daefa2c0a1d6f63

  • Good stuff Danny, ultimately I think we're going with a different approach, but this is great stuff for the future. Its a shame this damn property isn't available to set like ssom, it is a basic fundamental property of a View and nothing in in SPO APIs to set it. – Eric Alexander Apr 10 '16 at 3:10
0

I was looking for a solution. But it really does not seem to be supported today through CSOM.

Of course it is supported by SSOM, but I understand that is not an option in this scenario.

A possible alternative would be to set the JSLink of view. And create some custom code. It looks like a complex and strange solution. I wanted to mention it anyway.

Best regards!

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.