views:

415

answers:

2

Metadata seems to be used frequently to describe a SharePoint list's structure. That structure allows the storage of data at the list item level.

How can I specify information about the list itself without relying on an additional column?

Ideally I want something like SPList.Properties ["Mykey"] = "MyValue"

PropertiesXml isn't settable but is there any way to alter the data it returns?

+5  A: 

There is no property bag on the SPList object itself, however you can use the one on SPList.RootFolder. Its SPFolder object has a Properties property.

Alex Angas
Works perfectly. I also needed to call update on the SPFolder object after adding a new key/value pair (didn't Update() the list).
Michhes
Here's how I implemented this: http://blog.mediawhole.com/2009/07/storing-sharepoint-list-meta-data.html
Michhes
Nice - thanks for blogging about it!
Alex Angas
Great, but that properties are not stored in list templates. So I don't know how to allow end-users to create lists with them. Does anybody have any idea?
Dmitry Tashkinov
+1  A: 

As an alternative to Alex' direct answer, you could store the metadata on your lists in a separate dedicated, possibly hidden, list.

Paul-Jan
This idea has a lot of merit; the only hassle is defining and provisioning the list (although a two-column name/value style list would be reusable). I'd mark this as the second answer if I could!
Michhes