Is it necessary to call SPWeb.Update() after setting AllowUnsafeUpdates?
Question
Amidst working on resolving this issue, there's something I was curious about, and something that I've been very inconsistent about in my code.
If you enable SPWeb.AllowUnsafeUpdates = true
, do you have to call SPWeb.Update()
for that to be in effect? Or is just the one statement sufficient? I re-examined the WSS 3.0 SDK to look it up again, but either it's buried in a really random article or they aren't explaining it well.
I imagine that whatever is the case for setting it to true, it'll be the same for setting it to false in the finally
block.
Solution
You do not need to call SPWeb.Update()
because the AllowUnsafeUpdates
property is not persisted. (Reference Best Pattern for AllowUnsafeUpdates)
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange