SPSecurity Issue. Object Reference not set.

I’m trying to get a solution to run on a new server which apparently has been working fine on another server for years. It seems once I hit SPSecurity.RunWithElevatedPrivileges it throws “Object reference not set to an instance of an object.” I’ve even taken out the actual code within and just a simple WriteLine and still breaks. I’m really confused about what the issue is. The server should be a clone of the old one so not sure what’s missing.

SPSecurity.RunWithElevatedPrivileges(delegate() { Console.WriteLine("plz work"); }); 

submitted by /u/NakedLoki
[link] [comments]

Leave a Reply