Wednesday, October 19, 2011

"Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges"..."Request failed"

When I tried running some code within the "Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges" block I received this exception message:

System.Security.SecurityException was unhandled by user code
Message="Request failed."
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at JackBe.SharePoint.Core.Logging.SPLogger.Log(String message, CategoryID categoryID, TraceSeverity severity)
at JackBe.SharePoint.Core.Logging.SPLogger.Log(String message, CategoryID categoryID)
at JackBe.SharePoint.WebParts.MashletWebPart..ctor()
at T_27cf1440_c8a3_45ef_b04a_bcf1032711ed.CreateInstance()
at System.Web.HttpRuntime.FastCreatePublicInstance(Type type)
at System.Web.UI.WebControls.WebParts.WebPartManager.ImportWebPart(XmlReader reader, String& errorMessage)

It turns out the problem was I was executing this code too early in the page life cycle. I moved the block to "CreateChildControls" and the problem went away.

Monday, October 3, 2011

Recap from Tally Code Camp Talk

First of all I wanted to thank everyone who helped put together the code camp for this year. I had a blast and look forward to the next one. For those who wanted a copy of my slides and demo code on 'Building Robust SharePoint Applications' you can get it from my skydrive.

If you in or around the Tallahassee area I would like to encourage you to attend our next SharePoint user group meeting on Tuesday Oct. 18. Please visit our site to register.