Question

We have a custom application page "custom.aspx" on the Layout folder, would like to rename the original file "custom.aspx" to "custom_bak.aspx" before the updated/modified custom application page "custom.aspx" is placed on the same location while activating a custom feature.

any clue? how would I achieve it?

Was it helpful?

Solution 2

Use a FeatureReceiver that is triggered when a Feature is activated as described at http://salaudeen.blogspot.com/2011/03/sharepoint-feature-for-file-system.html

OTHER TIPS

If you are providing "custom.aspx" through your custom solution/feature the most logical place for doing backup of that file is by using SPFeatureReceiver.FeatureDeactivating method. So when you deactivate your feature backup is created and when you again activate it the new file will be provisioned.

If you are using modules or if you are providing application pages your file is most likely already deployed once SPFeatureReceiver.FeatureActivated fires so this is not good place to put backup code. Only scenario where this can be done is if you are doing all your file provisioning in code.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top