SharePoint pattern for allowing unsafe updates

As I said in my last post, I see some pieces of (ugly) code recur far too often in SharePoint. Probably most pervasive is the one to allow and not allow unsafe updates. In this post, I’ll provide a proper solution for this matter. The code excerpt that will be familiar to many of you:

Here’s how you can solve it:


This code ensures you don’t fiddle around with the settings that other components use. It’s nice and clean and it’s reusable across all projecs.

Written on June 16, 2015