Using the Web and Folder Properties Collections with CSOM (2013)

One annoying thing about CSOM in SharePoint 2010 is that there is no way to add persisted items to Web.AllProperties or Folder.Properties. This deficiency is fixed in 2013 but the way it works is not obvious because if you look at the objects (and you are me) you’d guess that the way to set a property is to manipulate the PropertyValues.FieldValues collection and you’d be wrong!

Here is a working example in C#.

var props = clientContext.Web.AllProperties;

 

props["propertyName"] = "Value";

 

clientContext.Web.Update();

 

In JavaScript use props.setItem("propertyName", "Value");

Happy coding!
–Doug

Author: Doug Ware