Remove Keys From PropertyBag on FeatureDeactivating Override
You can add keys to spweb propertybag trough a feature using CAML:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<PropertyBag ParentType="Web" RootWebOnly="False">
<Property Name="MyCustomProperty"
Type="string" Value="MyValue" />
</PropertyBag>
</Elements>
The property is written to SPWebs AllProperties propertybag. When you deactivate the feature, it does not remove the keys.
If you want to remove the keys when deactivating the feature, add Event Receiver to your Feature and the following code to the FeatureDeactivating override.
{
var web = (SPWeb)properties.Feature.Parent;
var allowUnsafeUpdates = web.AllowUnsafeUpdates;
var elementDefinitions = properties.Definition.GetElementDefinitions(CultureInfo.CurrentCulture);
foreach (var n in from SPElementDefinition elementDefinition in elementDefinitions
where elementDefinition.ElementType == "PropertyBag"
select elementDefinition.XmlDefinition into xml
where xml.Attributes != null && xml.Attributes["ParentType"].Value == "Web"
from n in
(from XmlNode xNode in xml
let xmlAttributeCollection = xNode.Attributes
where xmlAttributeCollection != null
select xmlAttributeCollection["Name"])
select n)
{
web.AllProperties.Remove(n.Value);
web.Update();
}
web.AllowUnsafeUpdates = allowUnsafeUpdates;
web.Update();
}
This sample only removes the keys, if the propertybag ParentType is “Web”, which means the key will be written to SPWebs AllProperties propertybag.
***********************************************
Jerry Seinfeld: Why not? We’re neighbors. What’s mine is yours.
Cosmo Kramer: [leaning against the door-frame and looking around in wonder] Really?
***********************************************
Popularity: 1% [?]
Suh studies are important and re good to keep tab onthe happenings n th insurnce secto.Many peοple love thei pet a fthey were th own hilren, and ωill go to any lesngth to protect the animal’s health and wll-being.You shoul be er lar in creatng your custod agrement.
Your style is really unique compared to other people I have read
stuff from. Many thanks for posting when you have the opportunity, Guess I’ll just bookmark
this web site.
My homepage :: ask.fm annon tracker [Evelyn]
great insight. Really enjoyed skimming through
this blog. Keep up the good work and to everyone keep on learning!
Feel free to visit my page :: free psn code generator with proof –
ipk.khsu.ru -
This article proof that there are writers who really care about the quality of content they share. Thank you for being this kind of writer. http://www.procarpetcleaningorlando.com/lakemary
When you deactivate the feature, it does not remove the keys. If you want to remove the keys when deactivating the feature, add Event Receiver to your Feature and the following code to the FeatureDeactivating override. public override void FeatureDeactivating (SPFeatureReceiverProperties properties) var web = (SPWeb) properties.
If you are looking for the best sexy chat experience on the whole web you must to visit hausfrauensex berlin
Tranny Sex UK is the most popular web page in United Kingdom for a free chat with local girls
Sex Kontakt in Göppingen is fine web place for your own sexy chat pleasure
What an informative post. Thanks for sharing! ADVANCE Appliance Ltd
Spend some extratime and find hot ladies for casual contacts in Italy Trans Sesso a Bari