Weird toolbar on Custom Document Library

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:

Weird View (BaseType 3)

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:

SPD - Where to Set BaseType 11

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.

Schema Changes

And testing shows:

Normal View (BaseType 11)

Great, the menus are back.

What is the BaseViewID though? Well, I’ve mentioned them before:

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.

Advertisement
Weird toolbar on Custom Document Library

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.