I’ve been writing a custom document Library Definition. Well, I say I was writing – I actually created it in SharePoint, and used the Solution Generator in the Visual Studio Extensions for WSS3 to produce the CAML and .aspx files.
Having done this, however, one of the views in my document library was a bit strange. Somehow, for this one view, the ‘New’ and ‘Upload’ menus were missing:
They were there for other views, just not this one. After examining the CAML (which sounds like some sort of euphemism) I found that the problem seemed to relate to the BaseViewID for the view. I found this by changing the ListView web part with SharePoint Designer:
If you set this to another BaseViewID (it was originally 3), this menu items reappear. The value should be a different base view to an existing one – when I used ‘1’ I got the columns from the my custom list’s View with BaseViewID 1. So, the short of it is, use a unique number other than 3.
Having determined this, I changed my Scheme.xml for my custom library definition in the same way. It’s the Views defined in this file that are copied into the ListView web parts when the library is created.
And testing shows:
Great, the menus are back.
What is the BaseViewID though? Well, I’ve mentioned them before:
- Pointing ListView Webparts at lists
- Pointing the ListView WebPart at a particular view
- The Summary Toolbar in a ListView Web Part
The documentation on BaseViewID doesn’t tell us a lot (not even in the documentation about the ListView web part in ONET.xml, or the SPView object), and there does seem to be a fair bit of confusion about it. From what I’ve been able to determine:
- The BaseViewIDs in a List Definition’s schema.xml don’t have to be a sequential set – that is, only having IDs (0,1,7,11,22) defined is fine.
- BaseViewID 3 doesn’t have New or Upload menus.
- Others have had the same problem with BaseViewID:3
- BaseViewID 3 on a Document Library seems to be the Explorer view – which I’d removed from my custom library definition before running Solution Generator.
Final conclusion – I think it was my removing the Explorer view that caused this issue (I didn’t do this as Corey Roth describes, I did it through the SharePoint UI before running Solution Generator). After deleting the Explorer view, my next new View went in at BaseViewId 3, which then acquired the lack of menus that you’d normally see in an Explorer view.