leather converse retrieving SPList property bag

retrieving SPList property bag

I have added a property bag to SPList. I would like to retrieve this property using ECMA script.

I have tried the below, but this returns default proper leather converse ties like Name of folder and Item count, but doesn’t return any other property and also custom properties that are added. I leather converse don’t think you can do this in the 2010 CSOM/JSOM. I think this was an oversight by the SP2010 dev team which has now been put right. You can of course do this easily with server side code. remove unnessary properties, when say the list is deleted.

So having done some further investigation on this I cannot find any way to retrieve a custom property from a folder property bag using ECMA script in SP2010 that object model simply just does not give us access to what we need. As indicated in my previous answer it seems that this limitation has been addressed in SP2013 but that’s not very useful if the application is required for 2010.

Accessing folder properties is simple if you are using the SharePoint sever OM but that’s not helpful if you only have have ECMA script at your disposal. So we’re stuffed, or are we time to think laterally.

If I correctly understand the intent behind the original question then what we are trying to do is find a way to save a simple property, say a string for some kind of configuratiuon purpose, at the list level. the property bag of leather converse the root folder because we need to access it via ECMA script and sadly that that doesn’t give the access we need for SP2010. somewhere which can be accessed by the ECMA OM, but where?

Well in my previous answer I suggested that we could elevate the property and save it in the web property bag and this would work just fine because ECMA does give us what we need to access the AllProperties of the web. However, there is a real risk that we would end up filling the web property bag with garbage as you would have to find a way to remove the unneccessary key/values when the list is deleted. Now this clean up task could be done in several ways including attaching event receivers to the list or maybe a custom timer job all of which seems like a lot of effort and complexity for such a simple task.

So if the web property bag won’t cut it then how about missappropriating an existing list property for our purposes. Surely we could find a spare string property of the list that serves not real prupose that we could grab and use/abuse to save our cu leather converse stom property value. Well, sadly no such ‘conveniently unused’ read/write string property exists on an SPList object (at least I couldn’t find one). I briefly thought about abusing the List’s Description field but that’s no good because we might want to use that for it’s intended purpose and it also shows up in the UI and can indeed be changed in the UI, all of which makes it an unlikley candidate. The only time when abusing the Description field might work is if the list is hidden and therefore has no UI to speak of.

So we’re done for, well not quite. If we can’t find a property of the list to abuse how about a property of a View for the list. it’s a self cleaning solution.

So a View is a good candidate but which property to use? Sadly an SPView has no Description property so we have to look wider and the best candidate I can find is the Toolbar property. The Toolbar property is a read/write string property that will have no impact on the View because our View will be hidden and have no use for a UI and so need for a tool bar property. There are lots of ways to do this but I’ve chosen to abstract the process out to a custom static utilites class which provides me we a few useful extension methods as shown below: