SPSecurity.RunWithElevatedPrivileges
February 22, 2010 — Florent ClairambaultIf like me you’re wondering what exactly does SPSecurity.RunWithElevatedPrivileges, this is what I understand of it :
1 2 3 4 5 | SPSecurity.RunWithElevatedPrivileges( () => { using( var newSite = new SPSite( site.Url ) ) { // your stuff } }); |
Is equivalent to :
1 2 3 | using( var newSite = new SPSite( site.Url, site.SystemAccount.Token ) ) { // your stuff } |
So if this is just to open an elevated privilege SPSite, it will be equivalent. But if you do some more complex things, as soon as you load a new SPSite it will open it with the original UserToken. And you lose…
GD Star Rating
loading...
loading...
