Saturday, September 6, 2008

Writing , Reading and Deleting entries from property bag

Scenario:
You want to save some keys/value information for a web.

Code:

// Add new key/value pair to the property bag.
web.Properties.Add("SomeKey", "SomeValue");
web.Properties.Update();

// Read the value of some key.
string keyValue = web.Properties["SomeKey"];

// Delete the key/value pair.
web.Properties.Remove["SomeKey"];
web.Properties.Update();

0 comments: