Clearing or removing a key&value from SPWeb.Properties (Tips&Tricks)

this quick trick can be use for removing a property correctly form SPWeb object.

string key="Identifier";
if (!web.Properties.ContainsKey(key))
return; //make a check is already exists.
web.AllProperties.Remove(key); //first clear from AllProperties.
web.Properties[key] = null; // remove property value
web.Update(); //update web object.
web.Properties.Update(); // update properties object.

See you in next tips…


About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: