Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static class SPWebExtensions
{
public static void RunWithUnsafeUpdates(this SPWeb currentWeb, Action action)
{
bool allowUnsafeUpdates = currentWeb.AllowUnsafeUpdates;
currentWeb.AllowUnsafeUpdates = true;
try
{
action.Invoke();
}
finally
{
currentWeb.AllowUnsafeUpdates = allowUnsafeUpdates;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment