Monday, November 03, 2008

Creating a Sharepoint List, Try 1

There seems to be a real lack of information on how to create a new sharepoint list in VB. Lots of examples in C#, but nothing in VB. And even for those of us that speak both languages and can usually translate back and forth, there seems to be a lack of useful "10,000 ft" information. I've been doing a lot of little test Sharepoint objects, and it seems like I'm constantly running into publish errors because my new item is still named "ListDefinition1" at some place that matters.

So here's how I do it. I'm going to update this post as I find glaring errors (as I'm sure I will).

Create a new Sharepoint List Definition project, and give it a decent name. Note that you do need the Visual Studio Sharepoint project templates for this (although, if you are pretty good at .NET, you can probably develop them from scratch...I'm not good at .NET, though).

Select your base list definition. I always add with event receiver (why develop a new object if it can't handle any events?), but I don't check the "Create an instance". I'm not sure what that one does, actually. I tend to develop off of the Announcements base class, since it's basic and handles inbound email.

At this point, it seems to still be named "ListDefinition1" in some places. Next I change all of these that I can find: the folder in the project, the schema.xml file, and the listdefinition.xml file. I don't know if I'm allowed to change the names of all of the files that are named pretty generically, but they don't have "ListDefinition1" in the name, so I don't worry about them. I'm also not sure about the Public Class definitions for the event receivers; it looks like I can change them, so I go ahead and change them.

There's another thing I ran into, I think only with webparts, though. The template includes references to MOSS DLLs. I'm not made of money, so I only have WSS. These references can be easily pulled; there's plenty of information out there on how to do this. Just google the error you get when you try to build.

That should be it. It's all those name changes that get you. But I'll update this if (when) I find errors to my methodology.

No comments: