Thursday, July 17, 2008

SPSecurity.RunWithElevatedPrivileges(delegate() .. error

I experienced an error while using SPSecurity.RunWithElevatedPrivileges(delegate() ... in my code.

Error message was : cannot convert from 'anonymous method' to 'Microsoft.SharePoint.SPSecurity.CodeToRunElevated'.

The problem was my return was inside the run with elevated privileges code. Once I took it out and placed it outside the run with elevated privileges code, the problem was fixed.

No comments: