SharePoint 2010: Setting SafeControl "SafeAgainstScript" property on web part installation -
is there way set safeagainstscript property of safecontrol entry in web.config file true upon installation / upgrade of web part? (it defaults false)
the safecontrol entry should appear follows:
<safecontrol assembly="microsoft.sharepoint, ..." namespace="microsoft.sharepoint" typename="*" safe="true" safeagainstscript="true" />
i installing third party web part , not have go , edit config file each time web part re-installed or upgraded.
well guess theres no "easy" way it.
you can edit web.config using spwebconfigurationmodification class http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebconfigmodification.aspx
http://msdn.microsoft.com/en-us/library/bb861909.aspx
however, can tricky , not recommendeded - safecontrol entries meant put in manually or using .wsp's manifest.xml file
so open .wsp winrar or 7zip, extract manifest.xml, make change safecontrol entry , reassemble , deploy it.
if want automate process, can using http://msdn.microsoft.com/en-us/library/system.io.packaging i'm sure find code snippets aswell
Comments
Post a Comment