Getting and Setting Properties in SharePoint

In SharePoint there are “property bags” on many elements of the system. For example, SPWebs and SPFolders have them, and methods like GetProperty() and SetProperty() to set them.

These methods accept and return objects. However, it’s nice to get values back in the same form as they were set. Continue reading “Getting and Setting Properties in SharePoint”

Advertisement
Getting and Setting Properties in SharePoint

Bloody Stupid SPWeb properties

So, like many SharePoint objects, the SPWeb object has a property bag. Unlike many, it has two – Properties and AllProperties.

The problem I encountered with this was that I was trying to set some Search Center settings on a newly created Site Collection, and their capitalization was being persisted wrongly:

newRootWeb.AllProperties["SRCH_ENH_FTR_URL"] = settings.SearchCenterUrl;

This would be persisted as lower case – which was wrong. Lower case capitalisation isn’t the same upper. Nice. Continue reading “Bloody Stupid SPWeb properties”

Bloody Stupid SPWeb properties