views:

121

answers:

1

There's a setting on the "Edit View" page in SharePoint 2010 that allows you to show all items in a list, ignoring folder structure. The setting is under Folders > Folders or Flat > Show all items without folders. My question is:

Is there any way to enable this setting via an XML list definition created in Visual Studio 2010?

Is there any way to view the XML view defintion for an existing list so that I can dig out the appropriate XML tags/attributes? Where are these stored in SharePoint?

+1  A: 

Don't know the setting off by heart - but save the Document Library as a template (with the flat view as you require it) - download it locally and rename it to a .cab file - you can see the XML markup in the file contained. You should be able to easily find the markup for the view in the contained XML.

I've used this trick regularly when my schema.xml doesn't behave exactly as I want.

EDIT: I quickly did this and got the markup for a flat view. I think the attribute you're looking for is Scope="Recursive".

Best of luck, Shane

Shaneo
Thanks Shane, just found it myself too. I've added it to existing list views and it works, but when I add it to the list defintion schema.xml and deploy it it's being removed. I've tried adding extra fields to views defined in my schema.xml to check that it's being deployed successfully and these are being brought across, but Scope is being left out. Any ideas?
Rob Bell
Have just found this: http://kvdlinden.blogspot.com/2010/04/schemaxml-onetxml-and-baseview-doesnt.htmlIt confirms that Scope is omitted from schema.xml definitions and needs to be added to the onet.xml file! Sounds like a bug to me, as it's possible to add Scope to existing list views.
Rob Bell
Yeah that sounds fishy alright - seems like a bug, I'll ask some of the guys here if they've met it before. It really does sound like a bug, would be interesting to see if it does the same thing in MOSS 2007.
Shaneo